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.
Note: |
|---|
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.
|