Many times programmers need to validate the user input at form level. ASP.NET provides validation control for web based development.
On a similar basis, we have introduced an updated version of the validation control for Windows application. This version provides validation for:
- Numeric only
- Any string (non-numeric)
- Characters only
- Regular expression based
- Range Validator
- Required field validator
It also contains a control Validation Summary which reports False if any control text is not valid. At the form level, we can check the status of all controls using:
If any one of the controls contains invalid input, then it will return
How to Use
Validation control is very simple to use. Follow these steps to add validation to your form controls:
- Add the Validation control in the Tool Box.
- Drag one on to form.
ControlToValidate property to the control you want to validate (Just choose from dropdown list).
- Set to Validation as property to either numeric only, any string (non-numeric) or characters only or RegularExpression.
- If you have selected Regular expression, then you need to set Regularexpression text.