Winform form窗体已弹出框的形式出现并回传值
From2(弹出框)回传数据到From1
Form1(数据接收form):
public string Sstr;
private void button1_Click(object sender, EventArgs e)
{
Form2 form= new Form2();
form.ShowDialog();
if (form.DialogResult == DialogResult.OK)
{
Sstr = form.Cstr;
}
}
Form2(回传数据的form):
public string Cstr;
private void button1_Click(object sender, EventArgs e)
{
Cstr= label.Text;
this.DialogResult = DialogResult.OK;
}