首先在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();
