devxlogo

Showing and enumerating MDI child forms

Showing and enumerating MDI child forms

An MDI child form is a regular form whose MdiParent property points to its MDI container form, so the code that creates and displays a child window is very simple:

Sub ShowMdiChildWindow()    ' Display the MenuForm form as a child of this form.    Dim frm As New MenuForm()    ' Make it a child of this MDI form before showing it.    frm.MdiParent = Me    frm.Show()End Sub

A form that can be used either as a regular form or an MDI child form might need to determine how it’s being used. It can do that by testing its MdiParent property or its read-only IsMdiChild property.You can list all the child forms of an MDI parent by using the Form array returned by its MdiChildren property:

Dim frm As FormFor Each frm In Me.MdiChildren    Debug.Write(frm.Text)Next

devx-admin

Share the Post: