FIX: ActiveForm Returns Wrong Form
Article ID: 174212
Article Last Modified on 12/10/2003
APPLIES TO
- Microsoft Visual Basic 5.0 Control Creation Edition
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
This article was previously published under Q174212
SYMPTOMS
When the ActiveForm property of the Screen object is queried, the wrong
form is returned as the active form. This behavior occurs after setting the
enabled property of a Command button on another form to False. The second
form is listed as the active form, when the form with the calling code is
actually the active form.
RESOLUTION
To work around this problem, insert the following line of code immediately
after the code that sets the enabled property of the button:
Me.SetFocus
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug has been fixed in Visual Basic
6.0.
Additional query words: kbVBp500bug kbVBp600fix kbVBp kbdsd kbDSupport kbVBA kbControl
Keywords: kbbug kbfix KB174212