两个窗体之间传递数据通过公共属性伪代码如下:
Form1.textBox2.text=public string transValue;
new Form2.textBox1.text=Form1.transValue;

解决方案 »

  1.   

    a good samplehttp://www.c-sharpcorner.com/Code/2002/Aug/PassingDataInForms.asp
      

  2.   

    先看http://expert.csdn.net/Expert/TopicView1.asp?id=1200055
    然后在Form2类里适当的事件中触发:this._myParentForm.textBox2.text=this.textBox1.text
      

  3.   

    1. Set the Modifies of Form1.textBox2 to internal.2. Define a private variable in Form2
    private Form1 _myParent;3.Create a constructor for Form2
    public class Form2(Form1 aForm)
    { _myParent = aForm;}4. Open Form2 in Form1:
    Form2 f2 = new Form2(this);
    f2.Show();5. You can set the value of Form1.textBox.Text with the _myParent in Form2 now._myParent.textBox2.Text = "";6. Sothing just like this, you can modify it for your self.
      

  4.   

    Oh,So quickly. 
    I overkilled.
      

  5.   

    the first form:
        Form2 frm = new Form2();
        frm.somename = textBox2.Text.Trim().ToString();the second form:
        private string anothername;
        public string somename
    {
    set 
    {
    anothername= value ;
    }
    }
    Form2.textBox1.text=anothername;
      

  6.   

    at last "Form2" can be removed.
      

  7.   


    public class Form2: System.Windows.Forms.Form
    private Form1 form1
    public Form2(Form1 form1)
    {
    this.form1=form1
    }然后就可以用
    form1.textBox2.text=this.textBox1.text