473,249 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,249 software developers and data experts.

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 6130
Banfa
9,065 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,065 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,065 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

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

Similar topics

11
by: Tony Johansson | last post by:
Hello! I have some problem with STL function remove I have two classes called Handle which is a template class and Integer which is not a template class. The Integer class is just a wrapper...
11
by: nephish | last post by:
Hello there, i need a way to check to see if a certain value can be an integer. I have looked at is int(), but what is comming out is a string that may be an integer. i mean, it will be formatted...
21
by: Frederick Gotham | last post by:
I set about trying to find a portable way to set the value of UCHAR_MAX. At first, I thought the following would work: #define UCHAR_MAX ~( (unsigned char)0 ) However, it didn't work for me....
1
by: charles_gero | last post by:
Hi all, I had a question about the topics in the subject and posted to comp.std.c, but feel it may also be appropriate here. Please excuse this crosspost if it is in bad form. I have a...
7
by: laura | last post by:
Hi, I have a variable of type double. I need to know if there is an integer number store there. How can I test that ? I also have a default precision for doing this operation. Many thanks,...
7
by: Spoon | last post by:
Hello everyone, In my code, I use uint16_t (exactly 16-bit-wide unsigned integer type) and I need to print their value in base 10. ...
9
by: jacob navia | last post by:
Hi I am incorporating 128 Bit integer code into lcc-win and it would be nice to have some code to test this feature. Has anyone here code that uses 128 bit integers? Thanks in advance ...
12
by: lithiumcat | last post by:
Hi, I bothered you a while back about storing integer values in void*. Now in a completely unrelated context, I'm trying to store pointer values in an integer type. So the basic question is,...
14
by: Default User | last post by:
Hi, If I have three 64 bit integers and I want to do this operation on them: x*y/z Lets say that what we are multiplying by (y) is offset by what we are dividing by (z) so that the final...
9
by: tsuyois | last post by:
Hi, I just signed in to this excellent network. I hope I could get some answers to many questions I have in writing C compilers. My first question is: Is "integer demotion" required in...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.