我有一个包含两种形式的项目。我必须将textbox1
中的数据form2
传递给form1
中定义的变量字符串m
。我的代码写在下面,但变量字符串m
是恒定的。两种形式之间传递的数据
表2:
public partial class Form2 : Form
{
Form1 frm1;
public Form2()
{
InitializeComponent();
frm1 = new Form1();
}
private void button1_Click(object sender, EventArgs e)
{
frm1.ModifyTextBoxValue = textBox1.Text;
this.Close();
}
表1:
public partial class Form1 : Form
{
string m = "12";
public Form1()
{
InitializeComponent();
}
public string ModifyTextBoxValue
{
get { return textBox1.Text; }
set { m = value; }
}
}
那么问题是什么? – andy