Microsoft KB Archive/90905

= Click Still Occurs when Using SetFocus to Prevent Focus Change =

PSS ID Number: 90905

Article Last Modified on 1/8/2003

-

The information in this article applies to:


 * Microsoft Visual Basic for MS-DOS 1.0

-



This article was previously published under Q90905



SYMPTOMS
You may still receive a Click event on a control even if you are trying to prevent a focus change (and the subsequent Click event) by forcing the focus back to the original control with a SetFocus method in the original control's LostFocus event.



STATUS
Microsoft has confirmed this to be a bug in Microsoft Visual Basic version 1.0 for MS-DOS. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Problem
 Start VBDOS.EXE. Form the File menu, choose New Form. Add two command buttons (Command1 and Command2) to the form (Form1). Exit the Form Designer (FD.EXE), and save all changes.  Add the following code to the appropriate event procedures: SUB Command1_Click MSGBOX &quot;Command1&quot; END SUB

SUB Command2_Click MSGBOX &quot;Command2&quot; END SUB

SUB Command1_LostFocus Command1.SetFocus   ' Set focus back to Command1 if lost. END SUB  Run the application, Command1 will receive focus by default.</li> Click or press TAB to Command2.</li></ol>

The focus should remain on Command1; no Click event for Command2 should be triggered. However, if you click many times in quick succession on Command2, the Command2_Click event may be fired.

Additional query words: VBmsdos buglist1.00 1.00

Keywords: KB90905

Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.