How To Determine Whether TAB or Mouse Gave a VB Control the Focus (75411)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 2.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
- Microsoft Visual Basic Standard Edition for Windows 1.0
This article was previously published under Q75411 SUMMARY
You can determine whether a Microsoft Visual Basic for Windows control
received the focus from a mouse click or a TAB keystroke by calling
the Microsoft Windows API function GetKeyState in the control's
GotFocus event procedure. By using GetKeyState to check if the TAB key
is down, you can determine if the user pressed the TAB key to get to
the control. If the TAB key was not used and the control does not have an
access key, the user must have used the mouse to click the control to set
the focus.
Modification Type: | Minor | Last Reviewed: | 2/11/2005 |
---|
Keywords: | kbhowto KB75411 |
---|
|