MDI Demo

This is a simple MDI form demo. It has only one child form. The child form contains a text box control which looks like a notepad. But this is not a Notepad sample. Opening, saving and other facilities of a standard Notepad application are not there. This program is given only to introduce you to MDI form. 

The textbox on the child form has scroll bars enabled and the MultiLine property is set to True. Thus it almost looks like a Notepad. When you resize the child form, the height and width of the textbox control remains as same as those of the child form.

The MDI form has a menu bar. It has three menu items - File, Window and Exit. The File menu item has a sub menu "New". On clicking New, a new instance of the form is created and displayed.

The Close File menu closes only the active form.

The Exit menu exits the whole application.

Learn about MDI forms first! Click here Lesson 66: MDI forms


                                                   >> DOWNLOAD

MDI demo sample


'Inside the MDI form module
Private Sub mnuCascade_Click(Index As Integer)
    Arrange vbCascade
End Sub

Private Sub mnuClose_Click()
    If Not (ActiveForm Is Nothing) Then Unload ActiveForm
End Sub

Private Sub mnuExit_Click()
    Unload Me
End Sub

Private Sub mnuNew_Click()
    Dim frm As New Form1
End Sub

Private Sub mnuWin_Click(Index As Integer)
        Select Case Index
        Case 0
            Arrange vbCascade
        Case 1
            Arrange vbTileHorizontal
        Case 2
            Arrange vbTileVertical
        Case 3
            Arrange vbArrangeIcons
    End Select

End Sub

'Inside the child form module
Private Sub Form_Resize()
    Text1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub