Validating Data

  • Thread starter Thread starter raflex
  • Start date Start date
R

raflex

Hello every one:

Can some one direct me to a good how-to or tips site
that teache how to validate the data the an user in puting
on a text field. what i want is some code to prevent the user
from inserting numbers on "name" fields or letter on a "date"
field.

thanks you all for your help >:}....
 
Hello,

raflex said:
Can some one direct me to a good how-to or tips site
that teache how to validate the data the an user in puting
on a text field. what i want is some code to prevent the user
from inserting numbers on "name" fields or letter on a "date"
field.

Why don't use specialized controls like DateTimePicker or NumericUpDown?

Regards,
Herfried K. Wagner
 
Intercept the keyDown events for the boxes you are using and throw away any
unwatned character types.



--
Regards - One Handed Man

Author : Fish .NET & Keep .NET
=========================================
This posting is provided "AS IS" with no warranties,
and confers no rights.
 
For sophisticated validation, look at the Validating event. For a more
"fundamental" approach:

KeyPress Event:

' This example would only allow numeric characters
'
If e.KeyChar < "0"c OR e.KeyChar > "9"c Then
e.Handled=True
End If
' Setting Handled = True tells the runtime to not process further


Larry Woods
 
Back
Top