C窗体间传值的几种方法(7)
发布时间:2021-06-06
发布时间:2021-06-06
this.textBox1.Text = f2.returnValue;
}
Form1 中 (父窗口:)
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnOpen;
public System.Windows.Forms.TextBox txtContent; //注意是public ........
........
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void btnOpen_Click(object sender, System.EventArgs e) {
Form2 frm=new Form2(this);
frm.ShowDialog();
}
}
Form2中(子窗口)
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox txtValue;
private Form _parentForm=null;
下一篇:料理机果汁做法大全