private void dataGridView1_UserDeletingRow(object sender, System.Windows.Forms.DataGridViewRowCancelEventArgs e) { string sql = $"delete from {table} where \"{fields[0]}\" = {e.Row.Cells[fields[0]].Value.ToString()}"; if (MessageBox.Show("вы уверены что хотите удалить запись?", "Внимание!", MessageBoxButton.YesNo) == MessageBoxResult.No) { e.Cancel = true; return; } execSql(sql); }
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); }
void dataGridView1_UserDeletingRow(object sender, System.Windows.Forms.DataGridViewRowCancelEventArgs e) { if (e.Row.Cells[0].Value is int) { if (MessageBox.Show("Are you sure to delete this object?", "", MessageBoxButton.YesNo) == MessageBoxResult.No) { e.Cancel = true; } else { int oid = (int)e.Row.Cells[0].Value; Sqo.Internal._bs._do(siaqodb, oid, metaType); oids.Remove(oid); } } else//is new { int oid = oids[oids.Count - 1]; Sqo.Internal._bs._do(siaqodb, oid, metaType); oids.Remove(oid); } }
private void ModuleList_dgv_UserDeletingRow(object sender, System.Windows.Forms.DataGridViewRowCancelEventArgs e) { throw new System.NotImplementedException(); }