468,457 Members | 1,621 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

integer-input ONLY textbox in GUI c++

How can I restrict the textbox in GUI C++ to integer-input ONLY ?

bcoz the function inside can only process int input parameter.
Apr 8 '08 #1
8 5603
Banfa
9,051 Expert Mod 8TB
What GUI are you using?
Apr 8 '08 #2
What GUI are you using?
MSVC++ 2005 Windows Form Application
Apr 8 '08 #3
Laharl
849 Expert 512MB
I'm not familiar with Microsoft C++, but if you take the input, you can check each character via the isdigit() function and if any aren't integers, you can clear it and tell the user to reenter.
Apr 9 '08 #4
Banfa
9,051 Expert Mod 8TB
Use a masked text box, you can set the mask to only allow digit input
Apr 9 '08 #5
Use a masked text box, you can set the mask to only allow digit input

thanks! but how can i set the user-input value be 4-digit ONLY in the masked text box??

another similar question: how to set the user-input shown to be asterisks (like password box)?
Apr 9 '08 #6
Studlyami
464 Expert 256MB
One of the properties of the text-box should say something like password. change the value from false to true. As far as limiting only 4 digits i don't know of a way to limit that. You may just have to let them type what ever they want and then perform a check to see if there is more than 4 digits or not.
Apr 9 '08 #7
Use a masked text box, you can set the mask to only allow digit input
but how to use masked text box to allow digit input only ?
Apr 10 '08 #8
Banfa
9,051 Expert Mod 8TB
but how to use masked text box to allow digit input only ?
In the property list for a masked text box there is property Mask set this to the mask of your input data.

You can read about masks here.
Apr 10 '08 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Tony Johansson | last post: by
21 posts views Thread by Frederick Gotham | last post: by
7 posts views Thread by laura | last post: by
7 posts views Thread by Spoon | last post: by
9 posts views Thread by jacob navia | last post: by
12 posts views Thread by lithiumcat | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.