title: Better way to update bound controls when changing the datasource
body: <p>The problem.  I have a databinding to the fields within a property on my form for a large number of textboxes on the form itself.  I am changing not just a field value within the property, but the entire property (resetting to a previously saved default).</p>
  
  <p>What I wanted to do was something like this:</p>
  
  <pre><code>((CurrencyManager)BindingContext[Row]).Refresh();
  </code></pre>
  
  <p>Doesn't work, <code>BindingContext[Row]</code> is a <code>PropertyManager</code>, not a <code>CurrencyManager</code>, and doesn't have a refresh method.  <code>PushData()</code> is protected and not accessable.  I also tried calling <code>this.Refresh()</code>, and individually on each control I tried calling <code>c.Refresh</code>...Now What?</p>
  
  <p>Here's the code Im currently using:</p>
  
  <pre><code>private void btnReset_ButtonClicked(object sender, EventArgs e)
  {
      Row = ResetRow.Clone();//use clone to break the reference, dont want to be updating the ResetRow when Row fields change.
  
      foreach (Control c in pnlBody.Controls)
          if (c.DataBindings.Count &gt; 0)
              c.DataBindings.Clear();
  
      DataBindandSet();//re-apply all the databindings (50)
  }
  
  //just a sample of the databinding function itself
  private void DataBindandSet()
  {
      txtAzimuth.DataBindings.Add(new NullableBinding("Text", Row, "Azimuth", true));
      txtBHTemp.DataBindings.Add(new NullableBinding("Text", Row, "BHTemp", true));
      //repeat 48 more times
  }
  </code></pre>
  
  <p><strong>Update</strong>
  I set the databindings to the full databinding string, to see if setting the null value default had any effect, it didnt.</p>
  
  <pre><code>txtAzimuth.DataBindings.Add(new NullableBinding("Text", Row, "Azimuth", true, DataSourceUpdateMode.OnPropertyChanged, ""));
  </code></pre>
  
  <p><code>Row</code> is a public property on the form itself.  <code>ResetRow</code> is a private property on the form, its assigned to a clone of the initial row on Form Load and never changed, it serves as a backup.  <em>The value of some of the properties (but not all) is allowed to be null, and should display as an empty string.  This is what the NullableBinding class does behind the scenes</em></p>
  
  <p>Can anyone think of a better way to do this than removing and re-applying every single one of the databindings?</p>