引用自:http://topic.csdn.net/u/20091221/18/5efb58d1-bea8-4b47-9ef1-460bf3102901.html 1.父窗口调用子窗口,关闭子窗口将内容返回给父窗口 //父窗口调子窗口函数 C# code private void ShowLinkDBDialog(object sender, EventArgs e) { //连接子对话框。 fchild obj = new fchild(this);//this父窗口 obj.WindowState = FormWindowState.Normal; obj.ShowDialog(); this.TextBox1.Text = obj.RetValue; } 子窗口相关内容 C# code private Form _parentForm=null; private static string _RetValue = null; public string RetValue { get { return _RetValue; } } // public fchild(Form parentForm)//带参数的构造函数 { InitializeComponent(); this._parentForm = parentForm; } //点确定按钮,返回信息到父窗口,并关闭子窗口. C# code private void confirm_Click(object sender, EventArgs e) { _RetValue = this.TextBox1.Text.Trim(); ((fparent)_parentForm).TextBox2.Text="123"; //关闭窗口 this.Close(); } 注意:以上代码包含了两种父窗口传值给子窗口的过程。 2.父窗体赋值给子窗体 在子窗体中这样写: C# code private string _strChild; public string strChild { set{_strChild=value;} } 父窗口传值给子窗口 C# code ...click(...) { FormChild formChild = new FormChild(); formChild._strChild = strParent;//不知道你这个strParent的值是否存在,还是为NULL. formChild .MdiParent = FormParent.ActiveForm;//这句可有可无,根据情况而定 formChild .WindowState = FormWindowState.Maximized; formChild .Show(); }