之前为了这事,百度了一天也没找到,最终使用了静态变量了。
窗体Form1:
private void button1_Click(object sender, EventArgs e)
{
var form2=new Form2(textBox1.Text);
form2.Show();
}
窗体Form2:
private readonly string _msg;
public Form2(string msg)
{
InitializeComponent();
_msg = msg;
}
private void Form2_Load(object sender, EventArgs e)
{
label1.Text = _msg;
}