[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Declaring a textbox as int?

Posted on 2006-05-09
Medium Priority
Last Modified: 2010-04-24

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!
Question by:Mahmoodaman
1 Comment
LVL 49

Accepted Solution

DanRollins earned 1600 total points
ID: 16703357
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question