Close one child and open a second child within the parent.

  • Thread starter Thread starter JohnK3JAE
  • Start date Start date
J

JohnK3JAE

Guest
I have fought this 50 ways from Sunday yet I am not being successful.

I am loading a parent named Menu1.

I can open forms coded within Menu1 via the button bar at top of the parent with no issues.

my MENU code in Menu1 (sample) is as follows:


Public MenuForm As Menu1

Private Sub MENU_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TireMaint.MenuForm = Me
Show()
ChangeLoc()
End Sub

Public Sub Tires()
If ActiveMdiChild IsNot Nothing Then ActiveMdiChild.Close()

TireMaint.MdiParent = Me
TireMaint.Show()
End Sub


Clicking on my 'Tire' Button on the PARENT form loads the TireMaint form perfectly.

On my CHILD forms (TireMaint in this case) I want to Close TireMaint and load another form... let's say PMMaint form.

I have the following on the TireMaint child form:


Public MenuForm As Menu1

Private Sub BtnPMMaint_Click(sender As Object, e As EventArgs) Handles btnPMMaint.Click
Dim PreventMaint As New MinorMaint With {
.MdiParent = MenuForm
}
If ActiveMdiChild IsNot Nothing Then ActiveMdiChild.Close()
PreventMaint.Show()
End Sub

Issue: The PMMaint form opens, always outside the Parent Container then I end up with multiple windows needing closed. How do I close the TireMaint form then open the PMMaint form from the TireMaint form yet remaining inside the parent container?

Continue reading...
 
Back
Top