title: DataGridView DataError Event Preserve invalid row
body: <p>I am working on a Winforms app that displays a DataGridView, bound to some database table.</p>
  
  <p>It allows inserting fresh entries in to it, and does some data validation.</p>
  
  <p>When a required column is left blank, or one of the unique constraints is violated, the DataError event calls this function:</p>
  
  <pre><code>protected void _data_error(object sender, DataGridViewDataErrorEventArgs e)
  {
      MessageBox.Show(this,e.Exception.Message,"Error");
      e.ThrowException = false;
      e.Cancel = false;
  }
  </code></pre>
  
  <p>When the popup is closed, the new row that was being edited is removed.<br>
  When this is done to a row that has already been saved (an update operation) the row loses its changes and loses focus.
  I assume this means I need to signal the application to keep the row editable, but I do not know how to do that.</p>
  
  <p>Paradoxically, if I replace the event handler with a <code>throw(e.Exception)</code> the exception gets thrown to the wind and is picked up by the uncaught exception handler, but the new row is preserved after that window closes.</p>
  
  <p>How can I preserve the new row on a DataError event?</p>
  
  <p>Edit:</p>
  
  <p>My next thought was to save the row and add it to the DataGridView's data source after the MessageBox pops up.
  That does not work because adding data to the data source add's it as a <em>committed</em> row which throws an exception because of the invalid data vs keeping the data as an <em>editable</em> row so that validation doesn't happen.</p>