title: ADO.NET databinding bug - BindingSource.EndEdit() changes current position
body: <p>What is the correct order of processing an insert from a data-bound control using <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.aspx" rel="nofollow noreferrer">BindingSource</a>, <a href="http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx" rel="nofollow noreferrer">DataSet</a>, and <a href="http://msdn.microsoft.com/en-us/library/7zt3ycf2%28v=vs.80%29.aspx" rel="nofollow noreferrer">TableAdapter</a>? This is causing me eternal confusion.</p>
  
  <p>I have a form that is used to add a new row.</p>
  
  <p>Before showing the form, I call:</p>
  
  <pre><code>bindingSource.AddNew();
  bindingSource.MoveLast();
  </code></pre>
  
  <p>Upon Save, I call:</p>
  
  <pre><code>bindingSource.EndEdit();
  tableAdapter.Insert([the row given to me as bindingSource.Current]);
  </code></pre>
  
  <p>The problem is that</p>
  
  <ul>
  <li>if I don't call <code>EndEdit()</code>, the changes of the TextBox with the current focus are not saved</li>
  <li>if I do call <code>EndEdit()</code>, the BindingSource's Current member no longer points to the row that I just added.</li>
  </ul>
  
  <p>I can of course call <code>Insert()</code> with the values from the form as opposed to the DataTable that was updated by the BindingSource, but that defeats the purpose of using data binding. What do I need to do in order to get this working?</p>
  
  <p>I understand that I could call <code>TableAdapter.Update()</code> on the entire DataSet, since I am using a strongly typed DataSet. I have foreign keys in the table that are not datab-bound, though, and that I am adding in before I call Insert().</p>