C#關閉登錄窗體,顯示主窗體


首先在programm.cs里設置登錄窗體顯示 

 static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            FrmReg fr = new FrmReg();
            if (fr.ShowDialog()== DialogResult.OK)
            {

                Application.Run(new FrmMain());
            }
           
        }
    }

 代碼中的FrmReg為登錄窗體,,登錄驗證成功后 顯示 FrmMain.cs窗體 

在登錄窗體FrmReg.cs的登錄按鈕中寫上以下代碼:

 JC.BLL.Login.Add(GetModel());
                MessageBox.Show("注冊成功!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
               //以下開始顯示主窗體 並關閉登錄窗體
                this.DialogResult = DialogResult.OK;
                this.Close();

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM