Hi all
I have a Mdi Child Fom being oppened from the parent the form opens but the Load event will not fire UP.
Doesn't the load event suppose to fire up every time the form is opened?
Here isthe code usedto open the form from the Parent and also the load even of the child form.

 Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim mdiChildForm As New Input_frm
        mdiChildForm.MdiParent = Me
        If Not CheckIfOpen("Input_frm") Then
            mdiChildForm.Show()
        End If
    End Sub

      Private Sub Input_frm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        MsgBox("Loaded")
    End Sub

Thanks In Advance

Recommended Answers

All 3 Replies

In the properties of the MdiParent look for IsMdiContainer and set it to true.

Can't see any reason why your code doesn't work. The problem might be in the CheckIfOpen function. Here's an alternative method to restrict having only 1 input_frm open at a time:

mdiParent:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim mdiChildForm As New Input_frm
    mdiChildForm.MdiParent = Me
    mdiChildForm.Show()
    Button1.Enabled = False
End Sub

mdiChild:

Private Sub Input_frm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
    Form1.Button1.Enabled = True
End Sub

Private Sub Input_frm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    MsgBox("loaded")
End Sub

Thank You both for your replies.
I had IsMdiContainer set to true.
Tinstaafl your solution worked I Disabled the CheckIfOpen and that did the trick.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.