FIX: Focus Does Not Return to an MDI Parent Form
ID: Q180747
|
The information in this article applies to:
-
Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0
SYMPTOMS
An MDI child form opens a second modal form and you then switch to another
Windows program. When you switch back to the second modal form and close
the modal form, the focus goes to the other Windows program instead of the
MDI child form.
RESOLUTION
There are two possible workarounds for this problem:
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.
MORE INFORMATION
Steps to Reproduce Behavior
- Start a new Standard EXE project in Visual Basic. Form1 is created by
default. Set the MDIChild property of Form1 to True.
- Add an MDI form to the project by completing the following steps:
- From the Project menu, click Add MDI form to display the Add MDI Form
dialog box.
- From the New tab, check that MDI form is highlighted.
- Click Open to close the Add MDI Form dialog box.
- Add a second form to the project.
- Add a CommandButton to Form1.
- Copy the following code to the Code window of Form1:
Option Explicit
Private Sub Command1_Click()
Form2.Show vbModal
End Sub
- Start another Windows program, such as Windows Explorer.
- Switch back to Visual Basic. On the Run menu, click Start or press the
F5 key to start the program. Click the Command Button to display the
Second form. Switch to the other Windows program using the ALT+TAB KEYS.
Switch back to the modal from with the ALT+TAB keys. Close the modal
form. Note that the focus goes to the Windows program rather than the
MDI Parent form.
Additional query words:
kbVBp500bug kbVBp600fix kbVBp kbdsd kbDSupport kbNoKeyWord
Keywords : kbGrpVB
Version :
Platform : WINDOWS
Issue type : kbbug