private void companyEntryToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); frmCompanyinfo frm = new frmCompanyinfo(); frm.lblUser.Text = User.Text; frm.lblUserType.Text = UserType.Text; frm.Show(); }
private void dataGridView2_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { try { if (SETS.Text == "CS") { DataGridViewRow dr = dataGridView2.SelectedRows[0]; this.Hide(); frmCompanyinfo frm = new frmCompanyinfo(); // or simply use column name instead of index //dr.Cells["id"].Value.ToString(); frm.Show(); frm.txtID.Text = dr.Cells[0].Value.ToString(); frm.txtcompanyName.Text = dr.Cells[1].Value.ToString(); frm.txtRegNo.Text = dr.Cells[2].Value.ToString(); frm.txtrole.Text = dr.Cells[3].Value.ToString(); frm.txtphone.Text = dr.Cells[4].Value.ToString(); frm.txtfax.Text = dr.Cells[5].Value.ToString(); frm.txtmob.Text = dr.Cells[6].Value.ToString(); frm.txtcity.Text = dr.Cells[7].Value.ToString(); frm.txtcountry.Text = dr.Cells[8].Value.ToString(); frm.txtState.Text = dr.Cells[9].Value.ToString(); frm.txtobjective.Text = dr.Cells[10].Value.ToString(); frm.txtdate.Text = dr.Cells[11].Value.ToString(); frm.txtpostalcode.Text = dr.Cells[12].Value.ToString(); frm.txtRelmgr.Text = dr.Cells[13].Value.ToString(); frm.txtinvestorType.Text = dr.Cells[14].Value.ToString(); frm.txttotalassets.Text = dr.Cells[15].Value.ToString(); frm.txtperatio.Text = dr.Cells[16].Value.ToString(); frm.txtmgtfee.Text = dr.Cells[17].Value.ToString(); frm.txtstaff.Text = dr.Cells[18].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.txtcompanyName.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }