Export (0) Print
Expand All

ErrorProvider Component Overview (Windows Forms) 

The Windows Forms ErrorProvider component is used to validate user input on a form or control. It is typically used in conjunction with validating user input on a form, or displaying errors within a dataset. An error provider is a better alternative than displaying an error message in a message box, because once a message box is dismissed, the error message is no longer visible. The ErrorProvider component displays an error icon (ErrorProvider icon) next to the relevant control, such as a text box; when the user positions the mouse pointer over the error icon, a ToolTip appears, showing the error message string.

The ErrorProvider component's key properties are DataSource, ContainerControl, and Icon. When using ErrorProvider component with data-bound controls, the ContainerControl property must be set to the appropriate container (usually the Windows Form) in order for the component to display an error icon on the form. When the component is added in the designer, the ContainerControl property is set to the containing form; if you add the control in code, you must set it yourself.

The Icon property can be set to a custom error icon instead of the default. When the DataSource property is set, the ErrorProvider component can display error messages for a dataset. The key method of the ErrorProvider component is the SetError method, which specifies the error message string and where the error icon should appear.

NoteNote

The ErrorProvider 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.

Community Additions

ADD
Show:
© 2014 Microsoft