private void btnEdit_Click(object sender, EventArgs e) { try { var row = dataGridView.CurrentCell.RowIndex; var id = Convert.ToString(dataGridView.Rows[row].Cells[0].Value); var name = Convert.ToString(dataGridView.Rows[row].Cells[1].Value); var address = Convert.ToString(dataGridView.Rows[row].Cells[2].Value); var contact = Convert.ToString(dataGridView.Rows[row].Cells[3].Value); var email = Convert.ToString(dataGridView.Rows[row].Cells[4].Value); var desigination = Convert.ToString(dataGridView.Rows[row].Cells[5].Value); var department = Convert.ToString(dataGridView.Rows[row].Cells[6].Value); var dateOfJoin = Convert.ToString(dataGridView.Rows[row].Cells[7].Value); var wageRate = Convert.ToString(dataGridView.Rows[row].Cells[8].Value); var hourWorked = Convert.ToString(dataGridView.Rows[row].Cells[9].Value); var addEmp = new AddEmployee(); addEmp.LoadData(id, name, address, contact, email, desigination, department, dateOfJoin, wageRate, hourWorked); addEmp.IdentityUpdated += this.UpdateRecord; addEmp.ShowDialog(); } catch (Exception exception) { MessageBox.Show(exception.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void addEmployee_Click(object sender, EventArgs e) { var addEmp = new AddEmployee(); addEmp.IdentityUpdated += this.SaveRecord; addEmp.ShowDialog(); }
private void addEmployee_Click(object sender, EventArgs e) { AddEmployee addEmp = new AddEmployee(); addEmp.IdentityUpdated += new AddEmployee.IdentityHandler(this.SaveRecord); addEmp.ShowDialog(); }