C textbox validating errorprovider
Net, you can drag and drop the control from the toolbox. Please refer to the code listing provided at the end of the article.Invoking the Set Error method of the Error Provider control displays an error indicator image next to the control specified as the first argument to the the Set Error method.You can have as many error providers on a form as you wish, but I can only see a potential use for two.
To display the dataset column error, invoke the Set Column Error method of the Error Provider.
I have attached a sample project written in C#, which has a typical (though simplified) data entry form for some customer information.
You will find as you tab through the textboxes on the form, that you will get the error icon appearing unless you enter data in the right format.
However, I only want this validation to occur when I click a button.
So I have an event that fires for that like so: I only want to close the form if the validation is successful. However, I don't want to have the validation run when the textboxes lose focus, only when the whole form is being validated. I have been using the Error Provider class to support this visually.