我在主窗口用Form childform = new housewin();调出一个子窗口。
后在窗口上放一个按键,按键的clike事件写 this.close(),但没效果!后改成 form.close()、envirement.close()都没用~
请教一下,谢谢

解决方案 »

  1.   

    ChildFormName childform = new ChildFormName();
    childform.show();
      

  2.   

    没太懂你的意思 你是想在主窗体中new一个新窗体出来 还是 new一个mdi子窗体?
    你的按键是放在主窗体还是放在新窗体中的?
      

  3.   

    在父窗体
    ChildFormName childform = new ChildFormName();
    childform.show();在你的子窗体的构造函数
             public frm_ChildFormName()
            {
                InitializeComponent();
                this.btnClose.Click += new EventHandler(btnClose_Click);
            }
      

  4.   

    你这样写的意思是关闭当前的窗体,不是关闭上一个窗体,直接学 this.close()就可以了
      

  5.   

    你要是能打开子窗口,在里面用this.close肯定没问题。
      

  6.   

    后在窗口上放一个按键。。你说的这个“窗口”是子窗口吧?
    Form childform = new housewin()这个是神马意思?主窗体: private void button1_Click(object sender, EventArgs e)
            {//打开子窗体
                this.IsMdiContainer = true;
                FrmChild frmChild = new FrmChild();
                frmChild.MdiParent = this;
                frmChild.Show();
            }
    子窗体: private void button1_Click(object sender, EventArgs e)
            {//关闭当前的窗体 也就是这个子窗体
                this.Close();
            }