Regular expression for validating date of birth

You can still use control validation to lock focus to a control, but you do not have to be concerned about the behavior associated with closing the form.

Form validation is an issue many websites must deal with.

When the user action occurs, you can trigger explicit validation in one of the following ways: However, in some cases, you might want to let the user close the form regardless of whether the values in the controls are valid.

You can override validation and close a form that still contains invalid data by creating a handler for the form's Closing event.

regular expression for validating date of birth-31regular expression for validating date of birth-67regular expression for validating date of birth-29

If you do not set the Cancel property, Windows Forms will assume that validation succeeded for that control, and raise the Validated event.

For a code example that validates an email address in a Text Box, see Validating.

Validation is very useful when you have bound your controls to a data source, such as a database table.

The implicit validation approach validates data as the user enters it.

You can validate the data as the data is entered in a control by reading the keys as they are pressed, or more commonly whenever the user takes the input focus away from one control and moves to the next.

Leave a Reply