MdiChild Forms in VB.Net

D

Deep Phee

Working with VB.Net I'm using a MdiParent form, bringing a child form as
follows:

Dim frmMaintenance As New frmMaintenance

frmMaintenance.MdiParent = Me

' Display the child form.

frmMaintenance.Show()



Now the frmMaintenance shows up just fine but I'd like to close it and
return to the frmMain (the MdiParent). The code I'm doing it with is:

frmMaintenance.ActiveForm.Close()

That line I'm 99% sure is not proper. When my Close event is fired it runs
that line and the whole application closes. I have serveral references I've
looked at and none of them

reveal how to close the MdiChild, frmMaintenance, in the case and return to
my MdiParent, frmMain.

Anyone have some advice?

Thanks

Phil
 
H

Herfried K. Wagner [MVP]

* "Deep Phee said:
Working with VB.Net I'm using a MdiParent form, bringing a child form as
follows:

Dim frmMaintenance As New frmMaintenance

frmMaintenance.MdiParent = Me

' Display the child form.

frmMaintenance.Show()



Now the frmMaintenance shows up just fine but I'd like to close it and
return to the frmMain (the MdiParent). The code I'm doing it with is:

frmMaintenance.ActiveForm.Close()

That line I'm 99% sure is not proper. When my Close event is fired it runs
that line and the whole application closes. I have serveral references I've
looked at and none of them

reveal how to close the MdiChild, frmMaintenance, in the case and return to
my MdiParent, frmMain.

In the child form:

\\\
Me.Close()
///

- or -

In the MDI container form:

\\\
Me.ActiveMdiChild.Close()
///
 

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