BUG: Closing a Child Form Causes an Application Error

Last reviewed: October 3, 1996
Article ID: Q149488
The information in this article applies to:
  • Standard, Professional, and Enterprise Editions of Microsoft Visual Basic, 16-bit and 32-bit, for Windows, version 4.0
  • Windows 95

SYMPTOMS

Closing a child form with a multiple-document interface, or MDI, through the Control box or Close button causes an application error in a Visual Basic program running under Windows 95. This behavior occurs only if the child form contains a Combo box with the Style property set to 1 - Simple Combo.

STATUS

Microsoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. Microsoft is researching this issue and will post new information here in the Microsoft Knowledge Base as it becomes available.

WORKAROUND

To work around this issue, close the form using the Unload statement in an event such as a click event of a command button or a menu item. To prevent the application error, use the following code in the Query_Unload event of the MDI child with the combo box:

   Private Sub Query_Unload(Cancel As Integer, UnloadMode As Integer)
      If UnloadMode = vbFormControlMenu Then
         Cancel = True
      End If
   End Sub

MORE INFORMATION

Steps to Reproduce Behavior

  1. Start 16-bit or 32-bit Visual Basic 4.0, or if it is already running, click New Project on the File menu.

  2. Add a combo box to the Form1 form. Set the Style property of the combo box to 1-Simple Combo.

  3. On the Insert menu, click MDI Form to insert an MDI parent form into the project.

  4. Set the MDIChild property of Form1 to True.

  5. On the Run menu, click Start or press the F5 key to start the program. Close the form using the Control box or the Close button. An application error occurs displaying one of the following messages and Visual Basic ends:

          32-bit Visual Basic-VB32 caused a general protection fault in module
    
                              USER.EXE at 0004:00001d43.
    
          16-bit Visual Basic-VB caused a general protection fault in module
                              USER.EXE at 0004:00001d43.
    


Additional reference words: 4.00 vb4win vb4all
KBCategory: kbbuglist
KBSubcategory: PrgOther



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 3, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.