日期:2014-05-18 浏览次数:20927 次
private void button1_Click(object sender, EventArgs e) { string userid = "asdfjkl";//定义一个用户名 string password = "123";//定义密码 if (txtUserId.Text == userid && txtpwd.Text == password) { // MessageBox.Show("登陆成功!"); this.Hide(); Form1 form = new Form1(); form.Show(); } else { MessageBox.Show("错误,你还可以输入"+(2-count)+"次!"); count = count + 1; } if (count == 3) this.Close(); } private void denglu_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyCode == Keys.Return) ; { button1_Click(); } }
private void denglu_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyCode == Keys.Return) ; { this.button1.PerformClick(); } }