Microsoft KB Archive/190220

= PRB: "Invalid Property Value" When You Query MDIChild Property =

Article ID: 190220

Article Last Modified on 5/12/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 Q190220



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.



Steps to Reproduce Behavior
 Create a new Standard EXE project in Visual Basic. Add an MDI form to the project by selecting Add MDI Form from the Project menu. Set the MDIChild property of Form1 to True.  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  Press F5 to run the project</li> Click on Form1.</li></ol>

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

Keywords: kberrmsg kbprb kbcode KB190220

-

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

© Microsoft Corporation. All rights reserved.