我正在尝试在VB.NET 2008中使用KeyPress事件,但它不起作用。有人能帮我找出这段代码的问题吗?该消息框和我从数据库中获取的状态都未显示。程序显示一切正常,但实际上并没有起作用。
If e.KeyChar = Chr(Keys.Enter) Then
tblLogin = Proses.ExecuteQuery("Select * From TblUser where kode_user = '" & KdUserTxt.Text & "'")
If tblLogin.Rows.Count = 0 Then
MessageBox.Show("Kode User Not Found!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
KdUserTxt.Focus()
Else
StatusTxt.Text = tblLogin.Rows(0).Item("status")
PswTxt.Focus()
End If
End If
'DROP TABLE TblUser;--
会怎么样? - Joel Coehoorn