private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if ((int)e.KeyChar == 13)//回车键的KeyChar键为13
{
if (textBox1.Text == "admin" && textBox2.Text == "1")
{
MessageBox.Show("登录成功!");
}
else
{
MessageBox.Show("登录失败!");
}
}
}
这段程序无法回车执行,很郁闷,求解!