Microsoft KB Archive/168850
Article ID: 168850
Article Last Modified on 12/10/2003
- 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 Q168850
When the Show method of an MDI child form is invoked, the MDI child form is not brought to the front.
To ensure that the correct window is brought to the top, use the ZOrder method. Replace the Show method with the ZOrder method.
In other words, you would replace the following line of code:
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
Steps to Reproduce the Problem
- Start a new Visual Basic 5.0 Standard Exe project. Form1 is created by default.
- Add an MDI form (MDIForm1) and a Form (Form2) to the project.
- Set the MDIChild property of Form1 and Form2 to True.
- Add two menu items to the MDIForm1. For the first menu item, set the Caption property to "ShowForm1" and the Name property to mnuShowForm1. For the second menu item, set the Caption property to "ShowForm2" and the Name property to mnuShowForm2.
Add the following code to the General Declarations section of MDIForm1:
Private Sub mnuShowForm1_Click() Form1.Show End Sub Private Sub mnuShowForm2_Click() Form2.Show End Sub
- Press the F5 key to run the project. Click on the ShowForm2 menu. Then click on ShowForm1. Notice that Form1 is not brought to the front.
Additional query words: active activated focus
Keywords: kbbug KB168850