private void invToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); frmInvestment frm = new frmInvestment(); frm.lblUser.Text = User.Text; frm.lblUserType.Text = UserType.Text; frm.Show(); }
private void dataGridView2_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (SET.Text == "CS") { DataGridViewRow dr = dataGridView1.SelectedRows[0]; this.Hide(); frmInvestment frm = new frmInvestment(); // or simply use column name instead of index //dr.Cells["id"].Value.ToString(); frm.Show(); frm.ID.Text = dr.Cells[0].Value.ToString(); frm.txtClientID.Text = dr.Cells[1].Value.ToString(); frm.txtclientname.Text = dr.Cells[2].Value.ToString(); frm.txtdate.Text = dr.Cells[3].Value.ToString(); frm.txtinvestmentType.Text = dr.Cells[4].Value.ToString(); frm.txtCUSIPNumber.Text = dr.Cells[5].Value.ToString(); frm.txtassettype.Text = dr.Cells[6].Value.ToString(); frm.txtgoal.Text = dr.Cells[7].Value.ToString(); frm.txtsector.Text = dr.Cells[8].Value.ToString(); frm.txtprice.Text = dr.Cells[9].Value.ToString(); frm.txtShares.Text = dr.Cells[10].Value.ToString(); frm.txtTotal.Text = dr.Cells[11].Value.ToString(); frm.txtcurrency.Text = dr.Cells[12].Value.ToString(); frm.lblUser.Text = lblUser.Text; frm.lblUserType.Text = lblUserType.Text; frm.btnUpdate.Enabled = true; frm.btnDelete.Enabled = true; frm.btnNew.Enabled = true; frm.btnSave.Enabled = false; frm.txtdate.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }