Friday, November 23, 2012

C# Windows Application Form validation using ErrorProvider


C# Windows Application provides an ErrorProvider control, which is similar to the ValidationSummary control in Asp.Net, this control consolidates all the error messages in the form and alerts the user on the Form errors.

In this post we shall see on the basics of the ErrorProvider control, the successive posts will show on how to use the control to perform various types of validations.
The ErrorProvider control has a SetError() method which takes 2 parameters, the Control and the Error message associated with the control, when the Error Message parameter is set against a control the a Red Error icon is displayed next to the control, and the Error message is displayed as a Tool Tip when the user hovers on the Error Icon.

Example:

ErrorProvider1.SetError(txtAge, “Please enter a valid Number.”);

Error provider Control

Error Message Sample



Search Flipkart Products:
Flipkart.com

No comments: