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 .
Get value from other form
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Nikesh Gupta10 pointsPosted Oct 23, 2005, 11:34 AM EDT
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; }1 short reply
tomekalaj16 pointsPosted Oct 27, 2005, 9:00 AM EDT