private void datagridViewEmployee_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { employeeUpdate emp1 = new employeeUpdate(); //get a data from data table int rowIndex = e.RowIndex; emp1.empId.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[0].Value.ToString(); emp1.firstname.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[1].Value.ToString(); emp1.lastname.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[2].Value.ToString(); emp1.contactno.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[3].Value.ToString(); emp1.homeContact.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[4].Value.ToString(); emp1.address.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[5].Value.ToString(); emp1.email.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[6].Value.ToString(); emp1.nicnumber.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[7].Value.ToString(); emp1.gender.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[8].Value.ToString(); emp1.firstDate.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[9].Value.ToString(); emp1.occupation.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[10].Value.ToString(); emp1.empSalary.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[11].Value.ToString(); emp1.combostatus.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[12].Value.ToString(); emp1.workphone.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[13].Value.ToString(); emp1.emeName.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[14].Value.ToString(); emp1.emeRelationship.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[15].Value.ToString(); emp1.emeContactNo.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[16].Value.ToString(); emp1.emeAddress.Text = this.datagridViewEmployee.Rows[rowIndex].Cells[17].Value.ToString(); emp1.ShowDialog(); }
private void btnUpdate_Click(object sender, EventArgs e) { //get update form employeeUpdate update = new employeeUpdate(); update.Show(); }