-1
这是我第一次在一个文本框错误说(在infoGather文本)“的对象引用需要非静态字段...”
private static void infoGather_keydown(object sender,KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (username == null)
{
username = infoGather.Text;
}
else
{
password = infoGather.Text;
if (username == "admin" && password == "admin")
{
MessageBox.Show("welcome");
}
}
}
}
遇到这个错误这是我第一次遇到它在TextBox
在哪里定义了用户名,密码和infoGather?他们是成员变量,不是静态的权利? –
是的定义。 –