0

My parent form has a few controls, the MDI child form is supposed to pop up at the bottom of the parent form. This all works as planned, but the issue is that my child form keeps popping up behind the controls of the parent form. The parent form is sent to false on TopMost and the child to True, I also tried bringing the child form to the front but nothing.

The child form is also boderless, I even try to put the borders back and see if that made a difference but it did not. here is my code to call the child form.

Private Sub ToggleButton(strButtonName As String, strReportTitle As String, strButtonDescription As String, objButton As Object, boolView As Boolean, boolStatus As Boolean)

Dim btnDescription As New frmButtonDescription(Me)

        If Not m_cToggleFlags.ContainsKey(strButtonName) Then
            m_cToggleFlags.Add(strButtonName, False)
        End If

        If m_cToggleFlags(strButtonName) Then

            btnDescription.Hide()
        Else

            btnDescription.lblReportTitle.Text = strReportTitle
            btnDescription.lblReportDescription.Text = strButtonDescription
            btnDescription.MdiParent = Me

            btnDescription.Show()
            btnDescription.BringToFront()
            btnDescription.btnOpenReport.Visible = boolView
            btnDescription.btnOpenDashboard.Visible = boolStatus


        End If

        m_cToggleFlags(strButtonName) = Not m_cToggleFlags(strButtonName)

    End Sub
Jose M.
  • 2,242
  • 8
  • 44
  • 66
  • 1
    Unfortunately that is the nature of MDI Forms, any controls that are on the parent form will be above the children. see this Possible duplicate http://stackoverflow.com/questions/4808109/controls-in-container-form-come-over-child-form/4809289#4809289 – Mark Hall Oct 21 '13 at 03:44
  • 1
    if the parent form's controls are confined to something like a panel, you can use a TableLayoutPanel to confine them to one section and leave another section open for the child. – Ňɏssa Pøngjǣrdenlarp Oct 21 '13 at 04:45
  • 2
    **DOCK** a Panel to the Top of the MdiParent and place those controls in that Panel. – Idle_Mind Oct 21 '13 at 05:20
  • 1
    You should not put controls in your MDI Parent unless you have them in a panel (or some other dockable control), and then you might want to make the child window full screen so it does not go behind the panel. – Steve Oct 21 '13 at 15:12
  • @MarkHall thanks for the information. Following the suggestions here and from the link you provided I was able to find a very suitable work around while still keeping the form's basic layout intact. – Jose M. Oct 22 '13 at 03:14
  • @JoseM. Glad I was able to be of help. – Mark Hall Oct 22 '13 at 03:18

0 Answers0