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.
You can override validation and close a form that still contains invalid data by creating a handler for the form's Closing event.
This approach is useful when you want to give the user immediate feedback about the data as they are working.
If you want to use implicit validation for a control, you must set that control's Auto Validate property to .
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.