public static void DeleteCellClickEvent(DataTier db, DataGridView dgv, int rowIndex, int columnIndex) { if (rowIndex >= 0 && columnIndex >= 0 && !dgv.Rows[rowIndex].IsNewRow && dgv.Rows[rowIndex].Cells[columnIndex].OwningColumn == dgv.Columns["Delete"]) { DialogResult dlg = MessageBox.Show(Messages.event_confirm_delete, Messages.application_confirm, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dlg == DialogResult.OK) { db.RemoveEvent((int)dgv.Rows[rowIndex].Cells["Id"].Value); db.LoadDataEvent(dgv); } } }
void f_RecordAdded(object sender, EventArgs e) { db.LoadDataEvent(dataGridView1); }
private void FormEvent_Load(object sender, EventArgs e) { Util.SetupGrid(dataGridView1); db = new DataTier(Util.GetCountyId()); db.LoadDataEvent(dataGridView1); }
public static void DeleteCellClickEvent(DataTier db, DataGridView dgv, int rowIndex, int columnIndex) { if (rowIndex >= 0 && columnIndex >= 0 && !dgv.Rows[rowIndex].IsNewRow && dgv.Rows[rowIndex].Cells[columnIndex].OwningColumn == dgv.Columns["Delete"]) { DialogResult dlg = MessageBox.Show(Messages.event_confirm_delete, Messages.application_confirm, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (dlg == DialogResult.OK) { db.RemoveEvent((int)dgv.Rows[rowIndex].Cells["Id"].Value); db.LoadDataEvent(dgv); } } }
private void FormEvent_Load(object sender, EventArgs e) { Util.SetupGrid(dataGridView1); db = new DataTier(Util.GetCountyId()); db.LoadDataEvent(dataGridView1); }