用show打开一个窗口的同时如何关闭前一个窗口

解决方案 »

  1.   

    starlogin lg = new starlogin();
                                    lg.Hide();
                                    starindex st = new starindex();
                                    st.Show();
    不行啊
      写在starlogin里面的
      

  2.   

    怎么会不行 你是webform还是winform如果是winform:
                                    this.Hide();
                                    starindex st = new starindex();
                                    st.Show();
    webform:
    <a href="javascript:window.opener='null';window.close();" style="color: black">关闭窗口</a>
      

  3.   

    可以了
      就是
       starform 中的 MessageBox.Show(this, "您的帐号不正确!", "错误提示");
    在提示的时候显示在starform的中间??????????
      在那里设置?????????
      

  4.   

    例如前一个窗口是FORM1后一个是FORM2
    FORM2 fr2 = new FORM2();
    fr2.show();
    FORM1.ActiveForm.Close();
      

  5.   

    这个可以了我
       就是说在用
    FORM2 fr2 = new FORM2();
    fr2.show();
    打开form2的时候如何设置他在桌面的显示位置??????????
      明白否?
    谢谢
      

  6.   

    写一个继承 ApplicationContext 的类 像这样就解决关闭启动窗体的问题了 
    static class Program
        {
            public class MyApplicationContext : ApplicationContext
            {
                public MyApplicationContext()
                {
                    frmSystemLogin frmStart = new frmSystemLogin();
                    frmStart.Show();
                }
                private void OnApplicationExit(object sender, EventArgs e)
                {
                }
                private void OnFormClosing(object sender, EventArgs e)
                {
                }
                private void OnFormClosed(object sender, EventArgs e)
                {
                }
            }        /// <summary>
            /// 应用程序的主入口点。
            /// </summary>
            [STAThread]
            static void Main()
            {
                Application.Run(new MyApplicationContext());
            }
        }
      

  7.   

    登陆窗口的StartPosition设为CenterScreen
      

  8.   

    把窗体的StartPostition属性设置为CenterScreen就可以了
      

  9.   

    如果不在设计界面将属性StartPosition设置成CenterScreen的话,也可以在登陆窗体中的Actived事件中设置