If you cancel the Validating event, the behavior of the control will be determined by what value that you assigned to Auto Validate.
If you assigned Enable Prevent Focus Change, canceling the event will cause the Validated event not to occur.
Assigning Disable to the Auto Validate property prevents implicit validation altogether.
To validate your controls, you will have to use explicit validation.
In the event, set the Cancel property to Note If you force the form to close in this manner, any data in the form's controls that has not already been saved is lost.
In addition, modal forms do not validate the contents of controls when they are closed.
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.
In the Validating event-handling method, you can validate user input in several ways.
For example, if you have a text box that must contain a postal code, you can perform the validation in the following ways: The Validating event is supplied an object of type Cancel Event Args.
It allows you to specify required characters, optional characters, literal characters, such as hyphens and parentheses, currency characters, and date separators.
The control also works well when bound to a data source.
Input focus will remain on the current control until the user changes the data to a valid input.