- Home
·
- Miscellaneous
·
- This code captures the Tab key, in certain situations. It is especially useful with the shift key
This code captures the Tab key, in certain situations. It is especially useful with the shift key
This code captures the Tab key, in certain situations. It is especially useful with the shift key
API Declarations
nVirtKey As Long) As Integer
Rate This code captures the Tab key, in certain situations. It is especially useful with the shift key
(1(1 Vote))
If GetKeyState(vbKeyTab) < 0 Then
If (GetKeyState(vbKeyShift) < 0) Then
' Shift-Tab key is pressed
GotFocusMethod = 4
Else
' Tab key is pressed
GotFocusMethod = 1
End If
ElseIf GetKeyState(vbKeyMenu) < 0 Then
' Alt key is pressed (hotkey activation)
GotFocusMethod = 2
ElseIf GetKeyState(vbLeftButton) < 0 Then
' mouse left button is pressed
GotFocusMethod = 3
End If
End Function
' Example on form
' use this in a _lostFocus sub
Private Sub txtEmployee_LostFocus(Index As Integer)
If GotFocusMethod = 4 And Index = 0 Then
'code goes here
End If
End Sub
This code captures the Tab key, in certain situations. It is especially useful with the shift key Comments
No comments yet — be the first to post one!
Post a Comment