private void btnLogin_Click(object sender, EventArgs e) { int returnValue = doperate.userLogin(comboBoxUName.Text.Trim(), textUPWD.Text.Trim()); if (100 == returnValue) { MainForm mainForm = new MainForm(); name = comboBoxUName.Text.Trim(); pwd = textUPWD.Text.Trim(); this.Hide(); mainForm.Show(); } else if (-100 == returnValue) { MessageBox.Show("用户名或密码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textUPWD.Text = ""; //comboBoxUName.Focus(); } }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { if (MessageBox.Show("您真的要退出本系统吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { Application.Exit(); } else { MainForm fmain = new MainForm(); fmain.Show(); } }