private void staffToolStripMenuItem_Click(object sender, EventArgs e) { frmStaff frm = new frmStaff(); frm.lblUser.Text = lblUser.Text; frm.Reset(); frm.Show(); }
private void dgw_MouseClick(object sender, MouseEventArgs e) { try { if (lblOperation.Text == "Staff Master") { DataGridViewRow dr = dgw.SelectedRows[0]; this.Hide(); frmStaff frm = new frmStaff(); frm.Show(); frm.txtID.Text = dr.Cells[0].Value.ToString(); frm.txtStaffID.Text = dr.Cells[1].Value.ToString(); frm.txtStaffName.Text = dr.Cells[2].Value.ToString(); frm.cmbStaffType.Text = dr.Cells[3].Value.ToString(); if (dr.Cells[4].Value.ToString() == "Male") { frm.rbMale.Checked = true; } else { frm.rbFemale.Checked = true; } frm.dtpDOB.Text = dr.Cells[5].Value.ToString(); frm.txtAddress.Text = dr.Cells[6].Value.ToString(); frm.txtCity.Text = dr.Cells[7].Value.ToString(); frm.txtContactNo.Text = dr.Cells[8].Value.ToString(); frm.txtEmailID.Text = dr.Cells[9].Value.ToString(); frm.btnUpdate.Enabled = true; frm.btnDelete.Enabled = true; frm.btnSave.Enabled = false; frm.lblUser.Text = lblUser.Text; lblOperation.Text = ""; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }