private void frmEmployeeRecord_FormClosing(object sender, FormClosingEventArgs e) { frmEmployeeDetails frm = new frmEmployeeDetails(); this.Hide(); frm.label21.Text = label1.Text; frm.label23.Text = label2.Text; frm.Show(); }
private void employeeToolStripMenuItem1_Click(object sender, EventArgs e) { this.Hide(); frmEmployeeDetails form2 = new frmEmployeeDetails(); form2.label21.Text = UserType.Text; form2.label23.Text = User.Text; form2.Show(); }
private void dataGridView2_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { DataGridViewRow dr = dataGridView2.SelectedRows[0]; this.Hide(); frmEmployeeDetails frm = new frmEmployeeDetails(); // or simply use column name instead of index //dr.Cells["id"].Value.ToString(); frm.Show(); frm.txtStaffID.Text = dr.Cells[0].Value.ToString(); frm.txtStaffName.Text = dr.Cells[1].Value.ToString(); frm.txtDepartment.Text = dr.Cells[2].Value.ToString(); frm.cmbGender.Text = dr.Cells[3].Value.ToString(); frm.DOB.Text = dr.Cells[4].Value.ToString(); frm.txtFatherName.Text = dr.Cells[5].Value.ToString(); frm.txtPAddress.Text = dr.Cells[6].Value.ToString(); frm.txtTAddress.Text = dr.Cells[7].Value.ToString(); frm.txtPhoneNo.Text = dr.Cells[8].Value.ToString(); frm.txtMobileNo.Text = dr.Cells[9].Value.ToString(); frm.dtpDateOfJoining.Text = dr.Cells[10].Value.ToString(); frm.txtQualifications.Text = dr.Cells[11].Value.ToString(); frm.txtYOP.Text = dr.Cells[12].Value.ToString(); frm.txtDesignation.Text = dr.Cells[13].Value.ToString(); frm.txtEmail.Text = dr.Cells[14].Value.ToString(); frm.txtBasicSalary.Text = dr.Cells[15].Value.ToString(); frm.txtLIC.Text = dr.Cells[16].Value.ToString(); frm.txtIncomeTax.Text = dr.Cells[17].Value.ToString(); frm.txtGrpInsurance.Text = dr.Cells[18].Value.ToString(); frm.txtFamilyBenefitFund.Text = dr.Cells[19].Value.ToString(); frm.txtLoans.Text = dr.Cells[20].Value.ToString(); frm.txtOtherDeductions.Text = dr.Cells[21].Value.ToString(); byte[] data = (byte[])dr.Cells[22].Value; MemoryStream ms = new MemoryStream(data); frm.pictureBox1.Image = Image.FromStream(ms); if (label1.Text == "Admin") { frm.Delete.Enabled = true; frm.Update_record.Enabled = true; frm.btnSave.Enabled = false; frm.label21.Text = label1.Text; frm.label23.Text = label2.Text; } else { frm.Delete.Enabled = false; frm.Update_record.Enabled = false; frm.btnSave.Enabled = false; frm.label21.Text = label1.Text; frm.label23.Text = label2.Text; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }