Microsoft KB Archive/189741

= BUG: Form Falls to Background When MsgBox Appears =

Article ID: 189741

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q189741



SYMPTOMS
When a project has two or more visible forms and a message box is displayed, one or more forms fall to the background, possibly behind other forms. This behavior did not occur in Visual Basic version 4.0.



CAUSE
This problem occurs when a MsgBox is displayed from a form that has the following properties set:

ShowInTaskBar = False BorderStyle = 3-FixedDialog



RESOLUTION
Change the ShowInTaskBar property to True or the BorderStyle property to something other than 3-FixedDialog.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps To Reproduce
 Start a new Standard EXE project in Visual Basic. Form1 is created by default. Add a new form (Form2) to the project.  In the Form1 Click event, place the following code: Private Sub Form1_Click Form2.Show End Sub

  In the Form2 Click event, place the following code. Private Sub Form2_Click MsgBox "Where's the Form?" End Sub

 Change the BorderStyle property of Form2 to number 3-Fixed dialog.</li> Change the ShowInTaskBar property of Form2 to False.</li> Press the F5 key to run the project.</li> Click on Form1 and then click Form2. The MsgBox is displayed and then Form2 drops to the background, possibly behind Form1.</li></ol>

Additional query words: kbDSupport kbVBp500bug kbVBp400bug kbMessageBox kbdss kbVBp600bug

Keywords: kbbug KB189741

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.