Declaring a textbox as int?


I am using Visual C++ 2005. I have a form with a textbox control. This text box accepts only Text by default.

How can I change its data type to int or float?

Thank you in advance!
Who is Participating?
In the dialog editor, right-click the text box and and select Properties.

Under the Styles tab, but a check in the Number checkbox (lower left)

Press Ctrl +W to bring up the Classwizard for the parent dialog.

Under the Member Variables tab, look for the ID of that edit box (it may be IDC_EDIT1).  Click it and then clcik [Add Variable].  

   Member Name:: m_nTheNumber
   Category: Value
   Variable Type: UINT (or "long" if you want to allow input of negative numbers)

You are done.

Now, whenever you need to learn what the user has typed in there, you can do:

    UpdateData( TRUE );
    if ( m_nTheNumber > 1000 ) {
        ... ta da...

-- Dan
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.