I have two forms. The second form is where I type things in. When I hit ok, how do I send the text in the textbox, to a different textbox on my other form?
Printable View
I have two forms. The second form is where I type things in. When I hit ok, how do I send the text in the textbox, to a different textbox on my other form?
You can give the form a property whose value you set from the other form or you can create a delegate which the first form uses to pass the value to the other form.
SomeStringProperty is the property that mendhak is talking about, that you declare in Form2:CSharp Code:
using (Form2 f2 = new Form2()) { if (f2.ShowDialog() == DialogResult.OK) { this.SomeTextBox.Text = f2.SomeStringProperty; } }CSharp Code:
public string SomeStringProperty { get { return this.SomeTextBox.Text; } }