C validating canceleventargs

posted by | Leave a comment

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.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.

Each control that accepts free-form user input has a Validating event that will occur whenever the control requires data validation.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.If you cancel the Validating event, the data will not be synchronized with the data source.Important If you have custom validation that takes place after the Validating event, it will not affect the data binding.

Leave a Reply

lesbiandating