CuriousGuy
Member
- Joined
- Aug 8, 2022
- Messages
- 7
- Programming Experience
- 1-3
Hi everybody,
I have two forms
form1 and form2
On form1 i got 1 textbox and one button.
When i click on that button it open me form2 and there is a DataGridView with some data from my MSSQL DB.
When i do an double click on one row, it should pass the data from the selected row to to the textbox on my form1.
I did it and it works.
But there i got a problem...
It open the form1 twice, what i don't want. I want, that it pass the data to the current open form1.
(I did attack two screenshots)
My codes;
Form1:
Form2:
It's maybe a very noobish question but i really stucked on this point. Thank you in advance.
I have two forms
form1 and form2
On form1 i got 1 textbox and one button.
When i click on that button it open me form2 and there is a DataGridView with some data from my MSSQL DB.
When i do an double click on one row, it should pass the data from the selected row to to the textbox on my form1.
I did it and it works.
But there i got a problem...
It open the form1 twice, what i don't want. I want, that it pass the data to the current open form1.
(I did attack two screenshots)
My codes;
Form1:
C#:
private void button1_Click(object sender, EventArgs e)
{
Form2 frx = new Form2();
frx.ShowDialog();
}
C#:
private void Form2_Load(object sender, EventArgs e)
{
this.mYRECORDSTableAdapter.Fill(this.okulDataSet1.MyRecords);
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
Form1 fr = new Form1();
fr.textBox1.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();
fr.textBox2.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
fr.ShowDialog();
this.Close();
}
Attachments
Last edited by a moderator: