Visual Basic Reference

AutoShowChildren Property Example

This example presents an MDIForm object with an MDI child form, uses the AutoShowChildren property to create a hidden form as another instance of the MDI child form, and then creates a visible MDI child form. To try this example, set the MDIChild property to True on Form1, and then create an MDIForm with the Add MDI Form command on the Project menu. Copy the code into the Declarations section of the MDIForm, and then press F5 to run the program.

Private Sub MDIForm_Load()
   MDIForm1.AutoShowChildren = False   ' Set to hide child forms.
   Dim HideForm As New Form1   ' Declare new form.
   HideForm.Caption = "HideForm"   ' Set its caption.
   Load HideForm   ' Load it; it's hidden.
   MDIForm1.AutoShowChildren = True   ' Set to show child forms.
   Dim ShowForm As New Form1   ' Declare another new form.
   ShowForm.Caption = "ShowForm"   ' Set its caption.
   Load ShowForm   ' Load it; it's displayed.
End Sub