Answer the question
In order to leave comments, you need to log in
How to pass values between forms?
Good afternoon. There are two forms
Form1 with value1 variable
Form2 with value2 variable
Answer the question
In order to leave comments, you need to log in
Use the "parent" property
/* в родительской форме */
Form2 f = new Form2();
f.Owner = this;
f.ShowDialog();
/* в дочерней форме */
Form1 main = this.Owner as Form1;
if(main != null)
{
string s = main.textBox1.Text;
main.textBox1.Text = "OK";
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question