DOCUMENT:Q174686 07-OCT-1997 [vbwin] TITLE :PRB: Error 371 or 5 Occurs When Using the Show Method PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0 OPER/SYS:WINDOWS KEYWORDS:vb5all kberrmsg ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0 --------------------------------------------------------------------- SYMPTOMS ======== When the MDI child form uses the Show method to open a form, you may receive the following error: Run-time Error '371': The specified object can't be used as an owner form for Show(). When the MDI child form uses the Show method to open an MDI Child form, you may receive the following error: Run-time Error '5': Invalid procedure call or argument. CAUSE ===== These errors occur if an MDI child form uses the Show method and specifies that it owns the form to display. An MDI child form cannot own another form. STATUS ====== This behavior is by design. MORE INFORMATION ================ While you can specify the owner of a form as one of the parameters in the Show method, you cannot designate an MDI Child form as an owner of another form. Steps to Reproduce Problem -------------------------- 1. Start a new Standard EXE project in Visual Basic. Form1 is created by default. 2. Add a CommandButton to Form1. 3. Add an MDI form and a second form to your project. 4. Set the MDIChild Property of Form1 to True. NOTE: To reproduce the error #5, set the MDIChild Property of Form2 to True as well. 5. Copy the following code to the Code window of Form1. Option Explicit Private Sub Command1_Click() Form2.Show vbModal, Me End Sub 6. Press the F5 key to run the program. Click the CommandButton and the error occurs. Additional query words: mdiform mdichild (c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Arsenio Locsin, Microsoft Corporation ====================================================================== Keywords : vb5all kberrmsg Version : WINDOWS:5.0 Platform : WINDOWS Issue type : kbprb ============================================================================= 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. Copyright Microsoft Corporation 1997.