form1中的Lable1的modifilers设为Public,  
   private void button1_Click(object sender, EventArgs e)  
      {      Form2 f2 = new Form2();  
    f2.ShowDialog(this);          
}    
  
form2中:
 private void button1_Click(object sender, EventArgs e)  
  {  
     Form1 f1 = (Form1)this.Owner;
            f1.label1.Text = textBox1.Text;  
  }  

解决方案 »

  1.   

    码兄,俺不懂啥意思?初学,感觉C#窗体传值挺麻烦。Form2里面加个私有字段Label lbl;然后加个构造函数
    public Form2(Label lbl):this()
            {
                this.lbl = lbl;
            }
    ....调用的时候
    Form2 f2 = new Form2(label1);
      

  2.   


    form2中:
     private void button1_Click(object sender, EventArgs e)  
      {  
         Form1 f1 = (Form1)this.Owner;
                f1.label1.Text = textBox1.Text;  
      }
    提示错误。
      

  3.   


    form2中:
     private void button1_Click(object sender, EventArgs e)  
      {  
         Form1 f1 = (Form1)this.Owner;
                f1.label1.Text = textBox1.Text;  
      }
    提示错误。
      

  4.   


    form2:
       private void button1_Click(object sender, EventArgs e)
            {
                Form1 f1 = (Form1)this.Owner;
                f1.label1.Text = textBox1.Text;  
            }
      

  5.   

    Form1 f1 = (Form1)this.Owner;
    Form1 为你的窗体名,
      

  6.   

    对!            frmWeiIn weiin = (frmWeiIn)this.Owner;
                //frmWeiIn weiin = new frmWeiIn();
                weiin.LBWeiIn.Text =this.textBox1.Text.Trim();
                this.Close();
    代码里frmWeiin就是我的窗体name
      

  7.   


            /// <summary>
            /// form1的属性,用来窗体间传值
            /// </summary>
            public string LabelText
            {
                get { return gLabel1.Text; }
                set { gLabel1.Text = value; }
            }        public Form1 owner;
            /// <summary>
            /// form2的构造函数
            /// </summary>
            /// <param name="form1"></param>
            public Form2(Form1 form1)
            {
                InitializeComponent();
                this.owner = form1;
            }        private void Button_Click(object sender, EventArgs e)
            {
                //传值
                owner.LabelText = textBox1.Text;
            }
      

  8.   

    frm2定义一个公共成员 类型为Lable lblTemp
    frm1有个Lable lblsourcefrm1中这样写frm2  f2  = new frm2();
    f2.lblTemp = this.lblsourc;
    f2.showdialog();frm2中这样写private void button1_Click(object sender, EventArgs e)
            {
                lblTemp.Text = this.textBox1.Text;
            }
      

  9.   


    form2中:
     private void button1_Click(object sender, EventArgs e)  
      {  
         Form1 f1 = (Form1)this.Owner;
                f1.label1.Text = textBox1.Text;  
      }
    提示错误。

    从错误信息看:应该是 frmMain fm=(frmMain )this.Owner;
      

  10.   


    form2中:
     private void button1_Click(object sender, EventArgs e)  
      {  
         Form1 f1 = (Form1)this.Owner;
                f1.label1.Text = textBox1.Text;  
      }
    提示错误。

    从错误信息看:应该是 frmMain fm=(frmMain )this.Owner;
    frmMain是个MDI父窗体,frmWeiin和frm2都是子窗体,frmWeiin调用了frm2.然后将frm2的textBox1.text值传到frmWeiin的Lable.text中。
      

  11.   

    http://blog.csdn.net/andywangguanxi/article/details/6575587看14楼版主专门开一贴说这个问题。自己先搜一把啊,分就这么用掉了,可惜~