Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI Child Close ?

Status
Not open for further replies.

other3

Programmer
Jul 30, 2002
92
US
The following code was done in VB.NET 2003. I have a MDI application that I can open any number of dialog type boxes
and this will close the one that is in the foreground no
matter what type of form it is. This only requires a menu
on the parent form.

Private Sub fileClose_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles fileClose.Click
If (Not Me.ActiveMdiChild Is Nothing) Then

Me.ActiveMdiChild.Close()

End If
End Sub

I want to do the same type of thing in VB 6.0, I've tried
traping the Form_Activate, Form_Deactivate events but that
does not seem to be leading me in the right direction. Any
help would be greatly appreciated.


Everything I know I learned from The Grateful Dead and Buffy The Vampire Slayer
Charlie
 
When you say "dialog type boxes" you actually mean "MDI Child Forms", I take it.

I will assume at this point that you know how to set up an MDI parent form and child forms in VB6. (If you don't, post back.) Just use the ActiveForm property in the MDI parent.
Code:
Unload Me.ActiveForm
Now, you can't put a command button on an MDI parent in VB6, so you'll have to invent something else, like a menu selection.

HTH

Bob
 
Thank you so very much.

That does the trick.



Everything I know I learned from The Grateful Dead and Buffy The Vampire Slayer
Charlie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top