You'll find that using the validation engine discussed here, you can instrument a wide range of validation criteria with very few lines of code.The Problem You want your program to validate form input, provide feedback to the user, and perhaps take other actions to handle the condition. Limitations This article presents a useful solution, though not a solution for every case.Initial Solution: The Error Provider Component To begin, you need to be aware of the handy Microsoft component called Error Provider (see the MSDN article "Error Provider Component Overview").Dragging an Error Provider onto the visual designer (or instantiating it in code) gives you the basic component required to display validation messages.the effort expended to get this far would be multiplied five-fold).So, for example, you'll find that the engine doesn't handle validation interaction between multiple fields; instead, I opted to focus on single-field validation for this introductory article.
You can use a single Error Provider for multiple controls.
Use this property to increase or decrease the blink rate of the icon. Default Value: 250 Blink Style This property controls whether the error icon blinks when an error is set.
Values (Default: Set Error This method sets the error description string for the specified control.
Example use of the Set Error method when validating a Text Box: The Error Provider displayed in the form: Set Icon Alignment This method sets the location where the error icon should be placed in relation to the control.
Note: You have to set the alignment for each individual control.
Error Provider with padding set to 1: Error Provider with the padding set to 10: Download the Error Provider Sample from our Downloads section.