private void button2_Click(object sender, EventArgs e) { flag = true; SingleForm start = new SingleForm(startForm); start.Show(); this.Close(); }
private void login_Click(object sender, EventArgs e) { try { //login.Focus(); if (userMessage.Text == "") { MessageBox.Show("请输入用户名!"); return; } if (password.Text == "") { MessageBox.Show("请输入密码!"); return; } //密码正确时:无此用户(先检查用户名) //待解决:线程失控 //点击右键:关闭窗口,不能关闭程序 string score = teris.UserLogin(userMessage.Text.Trim(), password.Text.Trim()); if (score.Equals("wrongUsername")) { MessageBox.Show("无此用户!"); } else if (score.Equals("wrongPasswod")) { MessageBox.Show("密码错误!"); } else { //StartForm startForm = new StartForm(userMessage.Text.Trim(), Convert.ToInt32(score)); SingleForm singForm = new SingleForm(userMessage.Text.Trim(), Convert.ToInt32(score), startForm); singForm.Show(); this.Visible = false; } } catch { MessageBox.Show("登录失败,请检查网络!"); } }