Click Still Occurs when Using SetFocus to Prevent Focus Change

ID: Q90905


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0


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.


MORE INFORMATION

Steps to Reproduce Problem

  1. Start VBDOS.EXE.


  2. Form the File menu, choose New Form.


  3. Add two command buttons (Command1 and Command2) to the form (Form1).


  4. Exit the Form Designer (FD.EXE), and save all changes.


  5. Add the following code to the appropriate event procedures:
    
           SUB Command1_Click ()
               MSGBOX "Command1"
           END SUB
    
           SUB Command2_Click ()
               MSGBOX "Command2"
           END SUB
    
           SUB Command1_LostFocus ()
               Command1.SetFocus    ' Set focus back to Command1 if lost.
           END SUB 


  6. Run the application, Command1 will receive focus by default.


  7. Click or press TAB to Command2.


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 :
Version : MS-DOS:1.0
Platform : MS-DOS
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.