MDI Parent and Childs - Opening and Closing

  • Thread starter Thread starter Brian P. Hammer
  • Start date Start date
B

Brian P. Hammer

I have a child form that opens within the MDIParent. From this child form (frmEntry), I open another child form(frmAircraftEntry). I do this by
Dim AircraftEntry As New frmAircraftEntry()
AircraftEntry.MdiParent = Me.MdiParent
AircraftEntry.Show()
Me.Close() ' close frmEntry

What I notice is that if I minimize the newly created form AircraftEntry, there is still an instance of frmEntry running even though I closed it. I am guessing it is from the call of = Me.MdiParent. If I move the me.close to the top of the sub, it closes the form as expected but then AircraftEntry does not open as a child. What am I doing wrong, or is there another way to determine the MDI parent?
 
I would try something. Pass in a ref to the MDIParent to the frmEntry(Me) on form construction. Save that to a private var of type Form (i.e. myMDIParent). Now set AircraftEntry.MdiParent = myMDIParent and see if that helps.
I have a child form that opens within the MDIParent. From this child form (frmEntry), I open another child form(frmAircraftEntry). I do this by
Dim AircraftEntry As New frmAircraftEntry()
AircraftEntry.MdiParent = Me.MdiParent
AircraftEntry.Show()
Me.Close() ' close frmEntry

What I notice is that if I minimize the newly created form AircraftEntry, there is still an instance of frmEntry running even though I closed it. I am guessing it is from the call of = Me.MdiParent. If I move the me.close to the top of the sub, it closes the form as expected but then AircraftEntry does not open as a child. What am I doing wrong, or is there another way to determine the MDI parent?
 
You may also first want to try setting Me.MdiParent to a local var first and then setting Aircraft.MdiParent to that local var. Then the local var should get gc'd on close.
I would try something. Pass in a ref to the MDIParent to the frmEntry(Me) on form construction. Save that to a private var of type Form (i.e. myMDIParent). Now set AircraftEntry.MdiParent = myMDIParent and see if that helps.
I have a child form that opens within the MDIParent. From this child form (frmEntry), I open another child form(frmAircraftEntry). I do this by
Dim AircraftEntry As New frmAircraftEntry()
AircraftEntry.MdiParent = Me.MdiParent
AircraftEntry.Show()
Me.Close() ' close frmEntry

What I notice is that if I minimize the newly created form AircraftEntry, there is still an instance of frmEntry running even though I closed it. I am guessing it is from the call of = Me.MdiParent. If I move the me.close to the top of the sub, it closes the form as expected but then AircraftEntry does not open as a child. What am I doing wrong, or is there another way to determine the MDI parent?
 
Thanks, I am now storing the MdiParent as a property which seems to work. Any issue with this that you know of?


Thanks

--
Brian P. Hammer
I would try something. Pass in a ref to the MDIParent to the frmEntry(Me) on form construction. Save that to a private var of type Form (i.e. myMDIParent). Now set AircraftEntry.MdiParent = myMDIParent and see if that helps.
I have a child form that opens within the MDIParent. From this child form (frmEntry), I open another child form(frmAircraftEntry). I do this by
Dim AircraftEntry As New frmAircraftEntry()
AircraftEntry.MdiParent = Me.MdiParent
AircraftEntry.Show()
Me.Close() ' close frmEntry

What I notice is that if I minimize the newly created form AircraftEntry, there is still an instance of frmEntry running even though I closed it. I am guessing it is from the call of = Me.MdiParent. If I move the me.close to the top of the sub, it closes the form as expected but then AircraftEntry does not open as a child. What am I doing wrong, or is there another way to determine the MDI parent?
 
Back
Top