VB KeyDown事件怎么写

来源:百度知道 编辑:UC知道 时间:2024/09/20 17:27:24
我把一个“PictureBox”控件做成了按钮,该控件的Click 事件如下:
Private Sub PicLogin_Click()
If Combo.Text = "Administrator" And txtPassword.Text = "ljm2004" Then
Frmmain.Show
Frmmain.StatusBar1.Panels(2).Text = "当前系统用户: Administrator"
Unload Me
Else
Adodc1.RecordSource = "select * from usertb where 名称='" + Trim(Combo) + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
If Trim(txtPassword) = Adodc1.Recordset.Fields("密码").Value Then
Frmmain.Show
Frmmain.StatusBar1.Panels(2).Text = "当前系统用户:" & Adodc1.Recordset.Fields("名称").Value
Unload Me
Else
MsgBox "密码不正确!", vbExclamation + vbOKOnly
End If
Else
MsgBox "无此用户或者密码不正确!", vbExclamati

Private Sub PicLogin_KeyDown(KeyCode As Integer, Shift As Integer)
在这里写的代码不就是你的要的吗?
end sub

这个好像有点难度了,要用API函数截取事件消息
具体的我也不会,去网上看看吧

中关村电脑网有范例