Validate number

P

Poppy

I have a text field I want to validate.

It needs to store a number

e.g "23.5", "10000"

Is there any isnum() method in .net.

TIA
 
D

Daren Hawes

Here we go
Dim x As String = "1.034"

If IsNumeric(x) Then

TextBox1.Text = "Yes x is Numeric"

End If
 
P

Peter Blum

If you are trying to validate the user's entry into a textbox, you should
consider using the validator web controls. CompareValidator will handle text
fields. Just set its Operator to DataTypeCheck and the Type to "Double".

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top