If Invoked by Access Key, Click Event Handled Before LostFocus (99875)
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
- Microsoft Visual Basic Standard Edition for Windows 4.0
- Microsoft Visual Basic for MS-DOS
This article was previously published under Q99875 SUMMARY
Below is an example showing that the Click and LostFocus events occur in
different order depending upon whether you cause the click event with the
mouse or the keyboard (with an access key). This behavior is by design.
When the focus changes between controls, the Click event can occur
before the LostFocus event in some situations. This is mainly because
certain events (including GotFocus, LostFocus, and clicking the button
with the mouse) are posted to a message queue and other events, such as
ALT+V from the keyboard, are issued directly.
To force the code for the LostFocus event to always execute before the
Click event code, place a DoEvents statement at the beginning of the Click
event code.
Modification Type: | Minor | Last Reviewed: | 8/16/2005 |
---|
Keywords: | KB99875 |
---|
|