MDI Parent and Childs - Opening and Closing

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?
 
W

William Stacey

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?
 
W

William Stacey

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?
 
B

Brian P. Hammer

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top