DOCUMENT:Q190220 07-AUG-1998 [vbwin] TITLE :PRB: "Invalid Property Value" When You Query MDIChild Property PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0 OPER/SYS:WINDOWS KEYWORDS:kbVBp500 kbVBp600 kbcode kberrmsg kbnokeyword ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0 --------------------------------------------------------------------- SYMPTOMS ======== In Visual Basic, if you query for the MDIChild property of an MDI Parent form, the following error occurs: Error 380 : Invalid Property Value CAUSE ===== MDI Parent forms do not have an MDIChild property. To query for this nonexistent property will result in the above error. RESOLUTION ========== To resolve this, use the following code to query for the MDIChild property of a form: Sample Code ----------- Dim f As Form For Each f In Forms If Not TypeOf f Is MDIForm Then If f.MDIChild Then Form1.Print f.Name & " MDI Child" Else Form1.Print f.Name & " Not MDI Child" End If Else Form1.Print f.Name & " Not MDI Child" End If Next STATUS ====== This behavior is by design. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Create a new Standard EXE project in Visual Basic. 2. Add an MDI form to the project by selecting Add MDI Form from the Project menu. 3. Set the MDIChild property of Form1 to True. 4. Paste the following code in the General Declarations section of Form1: Private Sub Form_Click() Dim f As Form For Each f In Forms If f.MDIChild Then Form1.Print f.Name & " MDI Child" Else Form1.Print f.Name & " Not MDI Child" End If Next End Sub 5. Press F5 to run the project 6. Click on Form1. An error message displays "Run-Time Error 380 : Invalid Property Value" instead of printing all of the names of the forms, and a value indicating whether or not they are an MDI Child form Additional query words: ====================================================================== Keywords : kbVBp500 kbVBp600 kbcode kberrmsg kbnokeyword 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 1998.