newfrm frm = new newfrm();
this.Hide();
frm.ShowDialog();
this.Dispose();

解决方案 »

  1.   

    application.run(new form());
    this.close();
      

  2.   

    newfrm frm = new newfrm(); 
    this.Hide(); 
    frm.Show(); 
    this.Dispose();
      

  3.   

    看你是否还回到这个窗口了,如果不回的话,就close,还要回来,就先HIDE
      

  4.   

    Form f= new Form();
    f.show()
    this.hide();
      

  5.   

    以VS2005为例
    在Program.cs中加入--- 
    static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                frmlogin f = new frmlogin();//初始化定义登录窗体frmlogin
                f.ShowDialog();
                if (frmlogin.b == true)
                {                Application.Run(new frmmain());
                }
                else if (frmlogin.b == false)
                {
                    Application.Run(new frmlogin());
                }
            }
    在frmlogin中:
    public static bool b = false;
    bool c = false; private void button1_Click(object sender, EventArgs e)//登录
    {
      frmlogin.b = true;
      c = true;
      Close();
    }
     private void button2_Click(object sender, EventArgs e)
            {
                //关闭窗体
                if (MessageBox.Show("真的要退出系统吗?", "提示:", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    c = true;
                    Application.Exit();            }
                else
                {            }
            }        private void frmlogin_FormClosing(object sender, FormClosingEventArgs e)
            {
                if (c == false)
                {
                    e.Cancel = true;
                }
            }
    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/hatchgavin/archive/2009/03/30/4037382.aspx
      

  6.   

    frmNew n=new frmNew();
    n.show();
    this.visible=false;
      

  7.   

    除非是两个单独的EXE文件调用另一个窗体,然后关闭当前程序