|
-
Jul 28th, 2010, 09:47 PM
#1
Thread Starter
Fanatic Member
How to only allow numbers to be typed in a textbox?
How could i only allow the user to type in numbers? (. allowed because of decimal points) and only 1 decimal point?
-
Jul 28th, 2010, 10:19 PM
#2
Re: How to only allow numbers to be typed in a textbox?
You can try this control of MartinLiss.
-
Jul 28th, 2010, 10:31 PM
#3
Re: How to only allow numbers to be typed in a textbox?
Search the forum for "only number textbox" or "numerical textbox" etc. But there are many complications to making this working properly, without cursor jumping around, then to think about pasting using keyboard, pasting using the right-click popup menu etc.
-
Jul 28th, 2010, 10:46 PM
#4
Re: How to only allow numbers to be typed in a textbox?
With modern computers, unless you're in a situation where fractions of seconds are important, just go through each character, Mid(.text,var,1), on the change event... it fires for keypresses, paste, and even WM_SETTEXT (which makes it useful for rudimentary interprocess communication).
-
Jul 29th, 2010, 12:30 PM
#5
Lively Member
Re: How to only allow numbers to be typed in a textbox?
You could also try to use the Masked Edit Control text box by adding the Microsoft Masked Edit Control component to your project. The mask of ####.# will allow numbers in the thousands and only one decimal.
-
Jul 29th, 2010, 02:21 PM
#6
Thread Starter
Fanatic Member
Re: How to only allow numbers to be typed in a textbox?
Hmm... Okay. THanks all for examples. =D
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|