That means the user cannot close the form unless the field passes validation.

Let’s assume when we click our save button that we wish to validate the controls and display an icon if there is a problem.

First, add the following code to the Form’s constructor after the Initialize Component method: This is a handy trick to prevent implicit validation of our controls when they lose focus.

I got to know about implicit validation and explicit validation but I feel better to use implicit validation only because its on time error provider when user looses focus on text box or if he shifts to another textbox.

I've posed this kind of question with a explicit validation code but no one responded me. Do not think I havent done enough research before posting this question.

The following code example uses the derived class Text Box and validates an e-mail address that the user enters.

If the e-mail address is not in the standard format (containing "@" and "."), the validation fails, an Error Provider icon is displayed, and the event is canceled. though: The Error Provider component does not provide built-in support for accessibility clients.To make your application accessible when using this component, you must provide an additional, accessible feedback mechanism. In that case you should also somehow tell the user that there’s a problem with the field. For example, if the user presses Tab, clicks on another control, presses Enter to trigger the Accept button, or presses Esc to trigger the Cancel button.For example, you could display an error message, change the field’s background color, or at least beep to let the user know that focus did not leave the field because something is wrong. The event triggers even if the user tries to close the form.In this case, we simply clear any error messages in the error provider.