试了很多方法都不行,只好求教了!!

解决方案 »

  1.   

    如果有2个窗口,窗口一的button1_Click按钮:private void button1_Click ( object sender , System.EventArgs e ) 

    Form2 myForm = new Form2 ( textBox1.Text , textBox2.Text ) ; 
    myForm.Show ( ) ; 
    } 就直接把窗口1的textBox1.Text , textBox2.Text传递到了窗口2。
      

  2.   

    用statc public类型的变量,通过类名可直接调用,例如:
    在form2中:
    string str=form1.str;
      

  3.   

    用static public类型的变量,通过类名可直接调用,例如:
    在form2中:
    string str=form1.str;
      

  4.   

    static public不太好,最好用Property实现
      

  5.   

    一个古老的新手问题,请看以前的贴子
    http://community.csdn.net/Expert/topic/4447/4447785.xml?temp=3.344363E-02
    http://community.csdn.net/Expert/topic/4261/4261838.xml?temp=.2679865
    http://community.csdn.net/Expert/topic/4144/4144408.xml?temp=.7305719
      

  6.   

    或者写一个abstract类,用静态成员来保存这些值
      

  7.   

    窗体1
    public string ID
    {
    get
    {
    return Txt_ID.Text;
    }
    }
    窗体2
    Form2 fm = new Form2()
    string str = fm.ID;