private void btn_addEmployees_Click(object sender, EventArgs e) { using (EmployeeED employeeED = new EmployeeED()) { if (employeeED.ShowDialog() != DialogResult.Cancel) { btn_clear.Hide(); this.loadEmployee(); } } }
private void dgv_employee_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { try { string employee_id = dgv_employee.Rows[e.RowIndex].Cells["id"].Value.ToString(); using (EmployeeED employeeED = new EmployeeED(employee_id)) { if (employeeED.ShowDialog() != DialogResult.Cancel) { txt_search.Clear(); btn_clear.Hide(); this.loadEmployee(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }