Wrox Programmer Forums
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2006, 07:53 AM
Authorized User
 
Join Date: Aug 2005
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Default closing mdi child forms

good evening!

i've placed 2 menu items CLOSE and CLOSE ALL in the FILE menu on my MDI form, now i want such a mechanism that,
 when i click on CLOSE, then the active MDI child form should be closed
and when i click on CLOSE ALL, then all the MDI child forms should be close

can n.e 1 guide me???

i'll w8 4 a good reply

 
Old May 31st, 2006, 03:08 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There are several ways to do this. Here is one:
Code:
Private Sub mnuCloseAll_Click()
    Do Until MDIForm1.ActiveForm Is Nothing
        Unload MDIForm1.ActiveForm
    Loop
End Sub
This assumes your menu item is named mnuCloseAll, and your MDIForm is named MDIForm1.

Each time you delete a active child form, the next one becomes the active one, so looping through each form this way works. When there are no more child forms, there is no MDIForm1.Activeform and the loop terminates.

Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
MDI & MDI Child Forms Menu's in VB2005 yulyos Visual Studio 2005 0 September 7th, 2007 09:49 AM
Opening MDI Child on Button Click of MDI Child Sachin Shinde Visual Studio 2005 0 June 8th, 2006 05:05 AM
Accessing the MDI form controls from child forms krishnasamaga Visual Studio 2005 1 June 7th, 2006 08:09 AM
Problem with loading MDI Child Forms. david29118 VB.NET 2002/2003 Basics 0 May 22nd, 2005 07:27 PM
MDI; other programs as child forms? Nick.Net VB.NET 2002/2003 Basics 0 November 28th, 2004 05:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.