I have this textbox as a user input. How do I check if
there's a number in the textbox, and no letters?
Printable View
I have this textbox as a user input. How do I check if
there's a number in the textbox, and no letters?
Try the isnumeric function.
If isnumeric(text1.text) then
I already figured that out... but thanx anyway :-)
Code:'in declarations:
option compare text
If isnumeric(text1) then 'it contains a numeric value
If text1 like "#" then 'it contains a number
if text1 like "*[!A-Z]*" then 'it contains no letters
There's 2 other possibilities.
Code:If Text1 like "*.*" Then 'it contains a decimal
If Text1 like "*-*" Then 'negative numbers
Hey Keda, now don't get sloppy my boy :)
I wonder where you were, not online my friend (ICQ).Code:If text1 like "#" then 'will only fire if there is only one number :) (like if string = "2", NOT string = "h280q821")
If text1 like "*#*" then 'this, instead, will fire if there's a number in the string (like if string = "h280q821")
One annoying thing about IsNumeric:
Code:?IsNumeric("$-6.0e-4")
True
Gives me false, remove the "$" and it should give true, thats because -6.0e-4 is expressed as a floating point. -6*10^(-4) which is -0.0004
yeah jop smart-ass! i was thinking about a number as one number. I'm online right now, but youre not:(