title: How to set ErrorProvider Icon left for all Controls programmatically
body: <p>We use derived Form-Classes, with one base form class for our software.</p>
  
  <p>On the derived forms we use DataBinding extensively to deal with our BusinessObjects, all implementing IDataErrorInfo, throwing custom error-messages on false inputs to the GUI with ErrorProviders.</p>
  
  <p>I now search for a way to implement a function in the base-form-class to get all ErrorProvider-Components on a Form and set the IconAlignment for every Control on the Form to left (since right is a spacing-problem).</p>
  
  <p>Any Hints welcome...</p>
  
  <p>Code for Setting the IconAlignment:</p>
  
  <pre><code>private void SetErrorProviderIconAlignment(ErrorProvider errorProvider, Control control)
  {
      errorProvider.SetIconAlignment(control, ErrorIconAlignment.MiddleLeft);
  
      foreach (Control subControl in control.Controls)
      {
          SetErrorProviderIcon(errorProvider, subControl);
      }
  }
  </code></pre>