FIX: Visual Basic 5.0 Focus Is Not Returned to a MDI Form After a Dialog Is Shown
Article ID: 172111
Article Last Modified on 12/10/2003
APPLIES TO
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
- Microsoft Visual Basic 4.0 Standard Edition
- Microsoft Visual Basic 4.0 Professional Edition
- Microsoft Visual Basic 4.0 Professional Edition
- Microsoft Visual Basic 4.0 16-bit Enterprise Edition
- Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
This article was previously published under Q172111
SYMPTOMS
In the versions of Microsoft Visual Basic listed at the beginning of this
article, if an MDI Form's Enabled property is set to False before a
CommonDialog (such as ShowOpen) is displayed, the focus does not return to
the MDI form, even if it is set programmatically. The subsequent behavior
is that instead of giving the MDI form the focus, focus is given to the
last window that had focus before the MDI form.
RESOLUTION
The current workaround for this confirmed bug is to not set the MDI
Form's Enabled property to False. The CommonDialog is Modal and
automatically disables the MDI Form because of its Modal nature. Thus
the workaround code for the code example in this article is:
Private Sub Picture1_Click()
CommonDialog1.ShowOpen
End Sub
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: kbVBp300bug kbVBp400bug kbVBp500bug kbVBp600fix kbVBp kbdsd kbDSupport kbControl kbMDI
Keywords: kbbug kbfix kbgrpdsvb KB172111