private void UserDeletingRow(object sender, System.Windows.Forms.DataGridViewRowCancelEventArgs e) { int noteId = GetNoteIdFromGrid(e.Row.Index); if (noteId <= 0) { // Note not in DB nothing to do. return; } var tmp = new DataMethods(); tmp.DeleteNote(noteId); }