I have one open Form1. I show Form2 (but Form1 is stile open) and when I close Form2 I nee to take value from Form2.textBox1.text in Form1.textBox1.text .
Loading
I have one open Form1. I show Form2 (but Form1 is stile open) and when I close Form2 I nee to take value from Form2.textBox1.text in Form1.textBox1.text .
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
tomekalajPosted Oct 27, 2005, 1:00 PM
Nikesh GuptaPosted Oct 23, 2005, 3:34 PM
Form2 frm2 =
new Form2(this);frm2.Show();
create an object of form1 in form2 and the constructor for form2 should be as following
private
Form1 frm1;public Form2(Form1 refForm)
{
InitializeComponent();
this.frm1 = refForm;
}
and then in the Closing event of form2 write the following code
private
void Form2_Closing(object sender, System.ComponentModel.CancelEventArgs e){
this.frm1.textBox1.Text = this.textBox1.Text;
}