我在form中写了这么一条语句:
Private Sub Form_KeyPress(KeyAscii As Integer)
If cmdSave.Enabled = True And KeyAscii = 19 then
MsgBox "haha"
End If
End Sub
执行后按Ctrl+S
结果msgbox弹出两次???不知为何?
...全文
44612打赏收藏
为何keypress执行两次?
我在form中写了这么一条语句: Private Sub Form_KeyPress(KeyAscii As Integer) If cmdSave.Enabled = True And KeyAscii = 19 then MsgBox "haha" End If End Sub 执行后按Ctrl+S 结果msgbox弹出两次???不知为何?
to xiamei(),sendkeys的使用要在控件获得焦点之后,这样写试试:
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
For Index = 0 To 4
If KeyAscii = 13 Then
text1(index).setfocus
SendKeys "{TAB}"
End If
Next Index
End Sub
大哥,借宝地一用,或者你教教我,我下面的程序不能执行。
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
For Index = 0 To 4
If KeyAscii = 13 Then
SendKeys "{TAB}"
End If
Next Index
End Sub