title: DataGridView event to catch a constraint exception?
body: <p>I have a list of employees, some of them are attached to groups. The model is:</p>
  
  <p>Mitarbeiter 1 --> n MitarbeiterGruppen
  Mitarbeiternr --> Mitarbeiternr</p>
  
  <p>I also have a datagridview which shows the employees (Mitarbeiter). Which would be the best event to catch the exception? Which exception should it be? And if the exception is thrown how can I do something like undo recordset?</p>
  
  <p>This is the event I picked, before I tested a bit with different exceptions, but I never got the right one. And very ugly, if the error (of course) is thrown, I can't end it.</p>
  
  <pre><code>    Private Sub DataGridMA_UserDeletingRow(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewRowCancelEventArgs) Handles DataGridMA.UserDeletingRow
      e.Cancel = True 'Danke. Löschen übernehmen ab jetzt wir
  
      Dim response As DialogResult = MessageBox.Show( _
      "Eintrag löschen? Bitte beachten Sie, dass zuerst die Gruppenzugehörigkeiten gelöscht werden müssen!", "Datensatz löschen", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
  
      If response = Windows.Forms.DialogResult.Yes Then 'Eintrag löschen
          e.Row.DataGridView.Rows.Remove(e.Row)
      End If
  End Sub
  </code></pre>