Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > How to close all child forms of MDI main frame?


Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2003, 09:43 PM
neptunezmz neptunezmz is offline
Newcomer
 
Join Date: Jul 2003
Posts: 11
Unhappy How to close all child forms of MDI main frame?


I want to close all child forms after user logged off.

how to do so?

thanks.
Reply With Quote
  #2  
Old 07-29-2003, 09:49 PM
rajeeshun rajeeshun is offline
Senior Contributor
 
Join Date: Oct 2002
Location: Dubai & Srilanka (Jaffna)
Posts: 1,151
Default

Quote:
Originally Posted by neptunezmz
I want to close all child forms after user logged off.

how to do so?

thanks.


--------

It means...? Do you want to close the child forms and want to get exit from the application ? Then use just "unload me" code line in the MDI form
Reply With Quote
  #3  
Old 07-29-2003, 10:04 PM
gundavarapu's Avatar
gundavarapu gundavarapu is offline
Senior Contributor
 
Join Date: Aug 2002
Location: In loved one's heart
Posts: 929
Default

If all you want is to close all the child forms present on the form, then you don't require any extra code. bydefault MDI form closes all its childs properly before exiting

But, if you want to close all the existing forms on the MDIForm without exiting the parent form, then you have to loop throught the activeforms on the screen using me.activeform and close them.
__________________
Regards,
Sidhu

When you do not get the expected result, change your programming language.
Reply With Quote
  #4  
Old 07-29-2003, 10:08 PM
neptunezmz neptunezmz is offline
Newcomer
 
Join Date: Jul 2003
Posts: 11
Default hey, thanks

how to loop through ActiveForms? Thanks again
Reply With Quote
  #5  
Old 07-29-2003, 10:08 PM
neptunezmz neptunezmz is offline
Newcomer
 
Join Date: Jul 2003
Posts: 11
Default hey, thanks

how to loop through ActiveForms? Thanks again
Reply With Quote
  #6  
Old 07-29-2003, 10:12 PM
neptunezmz neptunezmz is offline
Newcomer
 
Join Date: Jul 2003
Posts: 11
Default hi

I did it in this way, it works, but i don't know whether it's legal or whether there will be any problem.

Do While Not (Me.ActiveForm Is Nothing)
UnLoad Me.ActiveForm
Loop


Thank you very much!
Reply With Quote
  #7  
Old 07-29-2003, 10:30 PM
gundavarapu's Avatar
gundavarapu gundavarapu is offline
Senior Contributor
 
Join Date: Aug 2002
Location: In loved one's heart
Posts: 929
Default

its legal procedure, but instead you can use it with a object.

try this code

Code:
Dim frm As Form Do While Not (Me.ActiveForm Is Nothing) Set frm = Me.ActiveForm Unload frm Loop set frm=nothing
__________________
Regards,
Sidhu

When you do not get the expected result, change your programming language.
Reply With Quote
  #8  
Old 07-30-2003, 03:35 AM
neptunezmz neptunezmz is offline
Newcomer
 
Join Date: Jul 2003
Posts: 11
Default thanks

thanks all.
Reply With Quote
  #9  
Old 06-12-2004, 11:38 AM
jdezeeuw's Avatar
jdezeeuw jdezeeuw is offline
Freshman
 
Join Date: Mar 2004
Location: the Netherlands
Posts: 48
Default

Thanks for the code!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
I canceled the close button on child, but now mdi form won't close klincecum General 3 07-15-2004 12:10 PM
How to close all child forms of MDI main frame? neptunezmz Interface and Graphics 3 07-30-2003 02:14 AM
Makin a nice little program! Decontain Communications 3 04-11-2003 02:54 AM
MDI / Child forms CandiceBfureell General 2 12-06-2002 08:53 PM
MDI Child Forms NeverDie General 10 06-04-2002 05:42 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->