private void button2_Click(object sender, EventArgs e) { PDCManagement pdc = new PDCManagement(); foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(PDCManagement)) { //=============================================================================== // If form is already open //=============================================================================== form.Activate(); pdc = (PDCManagement)Application.OpenForms["PDCManagement"]; Classes.clsPDCManagement.userid = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); pdc.txtEmployeeID.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); pdc.txtName.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString(); } } Classes.clsPDCManagement.userid = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["userID"].Value.ToString()); pdc.txtEmployeeID.Text = dataGridView1.SelectedRows[0].Cells["EmployeeID"].Value.ToString(); pdc.txtName.Text = dataGridView1.SelectedRows[0].Cells["LastName"].Value.ToString() + ", " + dataGridView1.SelectedRows[0].Cells["FirstName"].Value.ToString() + " " + dataGridView1.SelectedRows[0].Cells["MiddleName"].Value.ToString() + dataGridView1.SelectedRows[0].Cells["Suffix"].Value.ToString(); this.Close(); }
private void button2_Click(object sender, EventArgs e) { PDCManagement pdc = new PDCManagement(); foreach (Form form in Application.OpenForms) { if (form.GetType() == typeof(PDCManagement)) { //=============================================================================== // If form is already open //=============================================================================== form.Activate(); pdc = (PDCManagement)Application.OpenForms["PDCManagement"]; pdc.txtLoanNumber.Text = dataGridView1.SelectedRows[0].Cells["Loan_No"].Value.ToString(); pdc.txtLoanType.Text = dataGridView1.SelectedRows[0].Cells["Loan_Type"].Value.ToString(); pdc.txtGross.Text = Convert.ToDecimal(dataGridView1.SelectedRows[0].Cells["Loan_Amount"].Value.ToString()).ToString("#,0.00"); } } pdc.txtLoanNumber.Text = dataGridView1.SelectedRows[0].Cells["Loan_No"].Value.ToString(); pdc.txtLoanType.Text = dataGridView1.SelectedRows[0].Cells["Loan_Type"].Value.ToString(); pdc.txtGross.Text = Convert.ToDecimal(dataGridView1.SelectedRows[0].Cells["Loan_Amount"].Value.ToString()).ToString("#,0.00"); this.Close(); }