刘垣瑾 Lauyj

毕业于山东海天软件工程学院

yj.Lau

导航

WinForm 实现登录,验证成功,关闭登录界面,显示主界面

点击登录按钮时;

1  if (this.txtLoginName.Text.Trim()=="admin" && this.txtLoginPwd.Text.Trim()=="123456")
2             {
3                 this.DialogResult = DialogResult.OK;
4                 this.Close();
5             }
6             else
7             {
8                 MessageBox.Show("用户名或密码错误", "信息提示");
9             }
 1 static class Program
 2     {
 3         /// <summary>
 4         /// 应用程序的主入口点。
 5         /// </summary>
 6         [STAThread]
 7         static void Main()
 8         {
 9             Application.EnableVisualStyles();
10             Application.SetCompatibleTextRenderingDefault(false);
11             LoginFrm lf = new LoginFrm();
12             lf.ShowDialog();
13             if (lf.DialogResult == DialogResult.OK)
14             {
15                 Application.Run(new MainFrm());
16             }
17             else return;
18         }
19     }

 

posted on 2015-06-08 17:52  yj.Lau  阅读(626)  评论(0编辑  收藏  举报