program类改成
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Login login = new Login();
login.Show();
Application.Run();
}
}
//登录按钮
private void btnLogin_Click(object sender, EventArgs e)
{
string UIds = this.txtUser.Text.Trim().ToString();
string UPassword = this.txtPwd.Text.Trim().ToString();
string UTypeName = this.cbbTypeName.SelectedItem.ToString();
if (new UserManager().AdminLogin(UIds, UPassword, UTypeName))
{
Login.ActiveForm.Close();
MainForm mf = new MainForm();
mf.Show();
}
else
{
MessageBox.Show("登入失败!");
}
}