windows Form两窗体数据传递
首先当单击form1的button1按钮时能出现第二个窗体,然后在form2的Textbox1中输入Text并单击form2的button1时,使Textbox1中的Text能够在form1的button1的Text属性中显示出来,同时关闭form2。我是在VS上做的,不能实现上述全部功能。大家帮忙看看我的有什么问题?以下是一些重要代码。多谢!public System.Windows.Forms.Button button1;
public System.Windows.Forms.TextBox textBox1;
private void button1_Click(object sender, System.EventArgs e)
{
Form2 form2 = new Form2();
form2.Show();
}
private void button1_Click(object sender, System.EventArgs e)
{
Form1 form1 = new Form1();
form1.button1.Text = this.textBox1.Text;
this.Close();
}