Validating the expression of zero
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.
When you use data binding, the data in your control is synchronized with the data source during execution of the Validating event.
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 Form Closing event.
If you determine that the control's data is not valid, you can cancel the Validating event by setting this object's Cancel property to .
If you do not set the Cancel property, Windows Forms will assume that validation succeeded for that control, and raise the Validated event.