private void buttonAdd_Click(object sender, EventArgs e) { using (FormAddEdit frm = new FormAddEdit(null)) { if (frm.ShowDialog() == DialogResult.OK) { refreshList(); disableEditButton(); } } }
private void buttonEdit_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to edit this?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (dataGridViewITLog.SelectedCells.Count > 0) { int selectedrowindex = dataGridViewITLog.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = dataGridViewITLog.Rows[selectedrowindex]; int id = Convert.ToInt32(selectedRow.Cells[0].Value); using (FormAddEdit frm = new FormAddEdit(id)) { if (frm.ShowDialog() == DialogResult.OK) { refreshList(); disableEditButton(); } } } } }