Q: number in the textbox

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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
 
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
 
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
 
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?
 
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
 
Back
Top