Form2 f;static void Main() 
{
Application.Run(new Form1());
}
private void button1_Click(object sender, System.EventArgs e)
{
f = new Form2();
f.label1.Text="a";
f.Show();
}在关闭时你可以在Form1中用f.label1.text得到Form2中label1中的值,但要注意在Form2中label1要定义成public.

解决方案 »

  1.   

    用事件,在form2关闭时将form2.label1.text的数据当作事件数据传递给form1.
      

  2.   

    一个很简单的方法:
    在form2中
    class form2{
    ...
        private Form f
        public form2(Form f){
            this.f = f;
            ...//内容与public form2(){...}里的一样
        }
        public override dispose(){
            f.label1.Text = this.label1.Text;
            ...
        }
    ...
    }
    ---------------------------------------- 修改
    static void Main() 
    {
    Application.Run(new Form1());
    }
    private void button1_Click(object sender, System.EventArgs e)
    {
    f = new Form2(this);
    f.label1.Text="a";
    f.Show();
    }看看行不。
      

  3.   

    可以考虑属性和事件相结合的办法
    在form2中定义
    public string strpwd
    {
    get
    {
    return this.textBox1.Text.Trim(); 
    }
    set
    {
    this.textBox1.Text=value;
    }
    }
      

  4.   

    一种思路,在form1和form2的命名空间中定义一个类封装要传递的数据,然户将数据用类的公共静态性质获取,只要是在这个命名空间的窗体和其他类都可以获得这个数据。
      

  5.   

    同意ksec()的说法,在form1或者form2的类中定义一个静态的变量用于存储要通信的数据,再在该类中定义一个可以取得和设置该变量值的公开方法,这样form2就可以不用show而用该方法即可通信。(可能要调用两次才能达到一次通信)