Q: number in the textbox

G

Guest

How can I grantee that user enter only number in the textbox. If possible
accept ","and "." in the number. Can I do this?
 
J

John Saunders

JIM.H. said:
How can I grantee that user enter only number in the textbox. If possible
accept ","and "." in the number. Can I do this?

Take a look at the validator controls. You can validate that the textbox is
non-empty, has a number in it and you can even validate that the number be
within a particular range of values.

John Saunders
 
G

Guest

can someone give me validation string?

John Saunders said:
Take a look at the validator controls. You can validate that the textbox is
non-empty, has a number in it and you can even validate that the number be
within a particular range of values.

John Saunders
 
J

John Saunders

JIM.H. said:
can someone give me validation string?

It's not just a simple string. You should spend a little time reading about
the Validation controls, otherwise any "validation string" won't help you.

Do you need a pointer to the MSDN documentation on the validation controls?

John Saunders
 
G

Guest

that might help. I have another related question, I defined myVar as double
and it seems myVar=myTextBox.Text statement converts text to double without
problem. Do you see any problem in that?
 
J

John Saunders

JIM.H. said:
that might help. I have another related question, I defined myVar as
double
and it seems myVar=myTextBox.Text statement converts text to double
without
problem. Do you see any problem in that?

Yes. Don't let VB.NET do such things for you. Turn "Options Strict On", and
decide for yourself what the relationship is between text and string.

I suggest that Options Strict be turned on always except possibly at the
very beginning of a migration from ASP.

John Saunders
 

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,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top