If the user enters invalid data they’ll see an icon shown in Figure 3.After the validating event returns without being cancelled, meaning we have valid user input, then the validated event will be raised.You need to set the Data Source, Data Member and Container Control properties of the Error Provider control to set the error for a databound control.To display the dataset column error, invoke the Set Column Error method of the Error Provider.In this case, we simply clear any error messages in the error provider.The Name textbox works very similarly but we don’t have quite as elaborate validation logic.You can customize the Error Provider control to set the Blink Rate and Blink Style.You can also display a custom error image instead of the default image. This article should not be construed as a best practices white paper.
However, I prefer to call it explicitly and handle all validation at once since you most likely will take action only if the entire control’s children pass validation. The most important thing to recognize here is how precise you can be with the validation error message in the error provider.
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.
What this component can do is display a little red icon beside any control which is invalid.
When the user hovers their mouse over this icon a tooltip is instantly displayed with information about the invalid field. While this may sound trivial, it's actually rather useful. An example which just checks to see if any data has been entered: You can have as many error providers on a form as you wish, but I can only see a potential use for two.
Now practice your newly learned skills on your own and experiment with the error provider control!