private void btn_A_Edit_Click(object sender, EventArgs e) { table = "tbl_Appointments"; Form frmEdit = new frm_Edit(permissions, table); frmEdit.StartPosition = FormStartPosition.CenterScreen; Program.setForm(frmEdit); this.Close(); }
private void btn_Edit_Click(object sender, EventArgs e) { int selectedIndex = 0; int rowID = 0; try { selectedIndex = dgv_Show.SelectedRows[0].Index; rowID = int.Parse(dgv_Show[0, selectedIndex].Value.ToString()); Form frm_edit = new frm_Edit(permissions, GetDepartment(department), rowID); frm_edit.StartPosition = FormStartPosition.CenterScreen; Program.setForm(frm_edit); this.Close(); } catch { MessageBox.Show("Please select a record.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }