顺序为
keydown
keyup
keypress
例:在窗体上建立一个文本框TextBox1,然后增加以下的事件处理代码;
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Print 1
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Print 2
End Sub
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Print 3
End Sub
然后运行窗体时在TextBox1文本框中敲一次键盘后,输出结果分别为1 2 3的顺序