private void login_Click(object sender, EventArgs e) { //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("wrong")) { MessageBox.Show("密码错误!"); } else { StartForm startForm = new StartForm(userMessage.Text.Trim(), Convert.ToInt32(score)); startForm.Show(); this.Visible = false; } }
//返回主菜单 private void button3_Click(object sender, EventArgs e) { StartForm startForm = new StartForm(); this.Hide(); startForm.Location = this.Location; startForm.ShowDialog(); Application.ExitThread(); this.Dispose(); }
private void login_Click(object sender, EventArgs e) { string score = teris.UserLogin(userMessage.Text.Trim(), password.Text.Trim()); if (score.Equals("wrong")) { MessageBox.Show("密码错误!"); } else { StartForm startForm = new StartForm(userMessage.Text.Trim(), Convert.ToInt32(score)); startForm.Show(); } }