[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

Close all open MDIChield form - VB 6.0

Development environment: Visual Basic 6.0

In my application, I have one MDIform and 4 MDI Chiledform.
In Menu (At MDIForm), there is a option "Close All Window".

I want if user select that option then it will be close all open MDI Chieldforms.
Please help me how to do this or what is the code I have to write for this ?

MDIform Name : MDISA

Chiled form name : 1. frmSA1; 2. frmSA2; 3. frmSA3; 4. frmSA4.

Anirban Dasgupta.
  • 2
1 Solution
anirban_abnAuthor Commented:
Close All Open MDI Chieldform - VB 6.0
Close All Child Forms in One Shot
In MDI applications, a user might have two or three or even more MDI child windows open at any given time. But in applications where you have user log-in and log-out security, you likely want to unload all open forms when the user logs out. To accomplish this, use this small piece of code:

Do Until MDIform1.ActiveForm Is Nothing
      Unload MDIform1.ActiveForm

If you need to save any values in any form by default, you can include a call to the appropriate Save method in the Unload event of that form.

Source: http://www.devx.com/tips/Tip/16877
anirban_abnAuthor Commented:
Thank you Dhaest.
It is working fine. Can you tell me one thing more, how can I understand any chiled window is currently open or not ?


Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now