We use derived class forms with one base class for our software.
In derived forms, we make extensive use of DataBinding to work with our BusinessObjects, all implementing IDataErrorInfo, throwing custom error messages to false inputs in the GUI using ErrorProviders.
Now I’m looking for a way to implement a function in the base class of the form, to get all the ErrorProvider-Form components in the form and set the IconAlignment for each control on the form to the left (since the right is a space).
Any hints are welcome ...
Code for setting the icon:
private void SetErrorProviderIconAlignment(ErrorProvider errorProvider, Control control)
{
errorProvider.SetIconAlignment(control, ErrorIconAlignment.MiddleLeft);
foreach (Control subControl in control.Controls)
{
SetErrorProviderIcon(errorProvider, subControl);
}
}
source
share