我有一个主窗体和一个用来填写信息的子窗体.如何让子窗体中填写的信息,更改到主窗体中.

解决方案 »

  1.   

    在子窗体中添加
    Form1 form1 = mainFrom; //Form1为主窗体
                           userContol uc = new userContol();
                            form1.Controls.Add(uc);
      

  2.   

    你可以试下在子窗体关闭时return 子窗体信息
    应该可以
      

  3.   

    form1
    Private void button1_click(....)
    {
    From2 f2=new Form2();
    f2.myevent+=give;
    f2.show();
    }
    public void give(string name)
    {
    this.label1.Text=name;
    }Form2
    public delegate void mydel(string name);
    public event mydel myevent;Private void button1_click(....)
    {
    if(myevent!=null)
    {
    myevent(this.TextBox1.Text);
    }
      

  4.   

    可以把主窗体中相应的控件的Modifiers属性改为public,直接在子窗体中为它赋值