tf卡接口定义:在VB的编程中,按ENTER键就触发的事件 是怎么实现的啊?

来源:百度文库 编辑:高校问答 时间:2024/05/04 19:07:39

Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
MsgBox "ok!"
End If
End Sub

用 KeyPress 或者 KeyDown 或者 KeyUp 呗。

就是呀~呵呵.

回车也有可能是10
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If (KeyCode = 13)Or(KeyCode = 10) Then
MsgBox "ok!"
End If
End Sub

通过KeyPress事件,例如你要实现按下回车显示“按下了ENTER!”,那么程序如下:
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then MsgBox "按下了ENTER!"
End Sub

command1.default = true
可是设定一个按钮为默认,当按下enter时就等同于点击这个按钮