I applied your's code but have some problem ,Everything is working except Form2 Don't close , if you see picture you can unserdtand What I will try to do .
obj.Controls["TextBox1"].Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); Form4 obj = new Form4();
Hi Ankit Singh //Create instance of the form2 class form2 obj = new form2 (); //Bind the datagridview values in the second popup form obj.Controls["TextBox1"].Text = dgvControl.Rows[e.RowIndex].Cells[1].Value.ToString(); obj.Controls["TextBox2"].Text = dgvControl.Rows[e.RowIndex].Cells[2].Value.ToString(); obj.Controls["TextBox3"].Text = dgvControl.Rows[e.RowIndex].Cells[3].Value.ToString(); obj.ShowDialog(); Here Rows[e.RowIndex].Cells[1],[2],[3] are the cell index which value pass to form2.
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Hi PATEL ;
I applied your's code but have some problem ,Everything is working except Form2 Don't close , if you see picture you can unserdtand What I will try to do .
obj.Controls["TextBox1"].Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString(); Form4 obj = new Form4();
obj.Controls["TextBox2"].Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
obj.Controls["maskedTextBox1"].Text = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
obj.Controls["TextBox7"].Text = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
obj.Controls["TextBox6"].Text = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();
obj.Controls["TextBox3"].Text = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString();
obj.Controls["TextBox4"].Text = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString();
obj.Controls["TextBox5"].Text = dataGridView1.Rows[e.RowIndex].Cells[8].Value.ToString();
obj.ShowDialog();
Form3 frm = new Form3();
obj.Hide();
this.Hide();
frm.Show();
//Create instance of the form2 class
form2 obj = new form2 ();
//Bind the datagridview values in the second popup form
obj.Controls["TextBox1"].Text = dgvControl.Rows[e.RowIndex].Cells[1].Value.ToString();
obj.Controls["TextBox2"].Text = dgvControl.Rows[e.RowIndex].Cells[2].Value.ToString();
obj.Controls["TextBox3"].Text = dgvControl.Rows[e.RowIndex].Cells[3].Value.ToString();
obj.ShowDialog();
Here Rows[e.RowIndex].Cells[1],[2],[3] are the cell index which value pass to form2.