I have two forms form1 and form2. I want to get the text from the textbox of form2 when a button is clicked on form1. I am using on form1:
private void but_Click(object sender, EventArgs e)
{
Form2 f2=new Form2();
txtonform1=f2.fo;
}
and on form2
I have this method to return the text from the textbox:
public string fo
{
get { return textBox1.Text; }
set { textBox1.Text = value; }
}
Now the problem is that it returns null
. Whats the problem I am new to c# can anybody help me please!