private void btnLogin_Click(object sender, EventArgs e) { AdminInfo ai = new AdminInfo(); ai.AdminName = this.txtUserName.Text; ai.AdminPwd = this.txtPwd.Text; bool dl = LoginBLL.AddAdminInfo(ai); if (dl) { if (tbx_Admin_Code.Text.Trim().ToLower() != strCode.ToLower()) { MessageBox.Show("验证码输入有误,请重新输入!"); strCode = Getcode(ran.Next(4, 5)); pictureBox1.Image = GetMap(strCode); tbx_Admin_Code.Text = ""; return; } MessageBox.Show("欢迎登录学生信息管理系统", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); frmMain genxintance = new frmMain(); genxintance.Show(); this.Hide(); } else { MessageBox.Show("登录失败"); } this.txtUserName.Text = ""; this.txtPwd.Text = ""; }