CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 1999
    Posts
    21

    New to programming (assigning variables to input from dialog boxes

    I am trying to take input by a user from a dialog box and assign variables to this input and do a mathmatical computation with these variables and spit them back out into a window. I could use info on the details of doing this. I am using Visual C++ 6.0. Thanks


  2. #2
    Join Date
    Jun 1999
    Location
    Canada - Québec
    Posts
    273

    Re: New to programming (assigning variables to input from dialog boxes

    try to use ClassWizard..
    -press Ctrl-W
    -go to "Member Variables"
    -assign variable to your control (category : value)
    -and in your code :
    UpdateData(); //put the value in control to your variable
    int m_value3 = m_value1 + m_value2; //do somthing with your variable
    UpdateData(FALSE); //put the value in variable to your control




    PS: Sorry for my english...


  3. #3
    Join Date
    Jun 1999
    Location
    Miami, FL
    Posts
    972

    Re: New to programming (assigning variables to input from dialog boxes

    You need to use the Class Wizard to "link" member variables to your dialog box's controls. This will make reading and writing the control's values simple.

    Read about it in the online help and/or go through the Scribble tutorial, specifically the section related to adding dialog boxes.

    Good luck!
    Alvaro


  4. #4
    Join Date
    Jul 1999
    Posts
    22

    Re: New to programming (assigning variables to input from dialog boxes

    The easiest way to do this is to use the classwizard and map a new member variable to the edit box or whatever you use for the Dialoginput. The wizard then will add this information to the DoDataExchange function and you can get hold off the values by simply accessing the variable.MFC does the dataexchange for you. Do your computation and then open new window for the output or replace the text in the editcontrol with the new values.
    Hope that helps.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured