private void btnLogin_Click(object sender, EventArgs e) { int type; LoginState state = miBll.LoginSys(txtName.Text, txtPwd.Text, out type); switch (state) { case LoginState.ok: FormMain fm = new FormMain(); fm.Tag = type; fm.Show(); this.Hide(); break; case LoginState.nameerror: MessageBox.Show("用户名错误"); break; case LoginState.pwderror: MessageBox.Show("密码错误"); break; default: break; } }