The following solution is suitable for users of VS2008
- Open Visual Studio 2008
- Choose MFC application
- Give a name to your project and click OK
- A dialog box pops up and click "Next" button
- Choose "Dialog Based", "Use MFC in a shared DLL" and "MFC standard" radio buttons, and then click Finish
- An empty dialog box shows in the IDE so you need to add some controls on this box
- In the Toolbox on the left, drag Edit Control on the dialog box, drag a Button on the box too
- Right click the dialog box and click Add Variable…
- A dialog, namely Add Member Variable Wizard – XXXX, pops up
- Make the checkbox next to Control variable having a tick
- Select the edit control you just added in Control ID
- Choose Variable in Category
- In the field of Variable name, input "var_from_edit_control"
- Select int in Variable type
- Press Finish
- Double-click the button, you created in the dialog box before
- In the Code View, insert the follow code
var_from_edit_control += var_from_edit_control;
- Compile the project using Debug->Start Debugging
- The application is compiled and executes.
- Click on the button. The value in the textbox will increase by 1 each time.