Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Control TXTbox = INT 1

Status
Not open for further replies.

NerdTop72

Programmer
Mar 14, 2005
117
US
brain fart...

How do I check to see if the text in a TXTBox is numeric?

if txtbox1.text is numeric then ???

Thanks,
Nerdtop72
 
One was is IsNumeric(). Someone once told me there is a slight problem with that, but it has always worked fine for me.

-I hate Microsoft!
-Forever and always forward.
 
Thanks for the fast response!!
Is there a problem because of whole numbers and decimals or something?

I totally forgot about IsNumeric, the whole time I thought my problem was spelling Numeric wrong
HaHa

Thanks again!
 
:) My memory is going so I had to look up my thread. We talked about it here: thread796-1418806

-I hate Microsoft!
-Forever and always forward.
 
If IsNumeric does cause you a problem, then you could think about using a simple RegEx.

Hope this helps.

[vampire][bat]
 
Sorry I forgot to add a sample RegEx:

^\d+\.?\d*$"

[tt]
^ = start of string to match
\d+ = any number 1 or more times
\.? = optional .
\d* = optional any number
$ = end if string to match
[/tt]

Hope this helps.

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top