private void dataGridView3_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { DataGridViewRow dr = dataGridView3.SelectedRows[0]; this.Hide(); frmEmployeePayment frm = new frmEmployeePayment(); // or simply use column name instead of index //dr.Cells["id"].Value.ToString(); frm.Show(); frm.PaymentID.Text = dr.Cells[4].Value.ToString(); frm.cmbstaffid.Text = dr.Cells[3].Value.ToString(); frm.txtEmployeeName.Text = dr.Cells[0].Value.ToString(); frm.txtDesignation.Text = dr.Cells[1].Value.ToString(); frm.txtDepartment.Text = dr.Cells[2].Value.ToString(); frm.txtBasicSalary.Text = dr.Cells[5].Value.ToString(); frm.txtModeOfPayment.Text = dr.Cells[10].Value.ToString(); frm.txtPaymentModeDetails.Text = dr.Cells[11].Value.ToString(); frm.txtTotalPaid.Text = dr.Cells[6].Value.ToString(); frm.txtDeduction.Text = dr.Cells[7].Value.ToString(); frm.txtDuepayment.Text = dr.Cells[8].Value.ToString(); frm.PaymentDate.Text = dr.Cells[9].Value.ToString(); frm.Delete.Enabled = true; frm.Update_record.Enabled = true; frm.Print.Enabled = true; frm.btnSave.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmEmployeePaymentRecord_FormClosing(object sender, FormClosingEventArgs e) { this.Hide(); frmEmployeePayment frm = new frmEmployeePayment(); frm.Show(); }
private void salaryPaymentToolStripMenuItem1_Click(object sender, EventArgs e) { frmEmployeePayment frm = new frmEmployeePayment(); frm.lblUserType.Text = UserType.Text; frm.lblUser.Text = User.Text; frm.Show(); }