form close upon MDI form 
Author Message
 form close upon MDI form

I have a MDI form and some MDI child but some are non child. I got 2
problems.

1. When I open a non child form and i close the MDI main form the non child
will keep open until i close it!! how can i close all the non child ,
toolbox ... etc . when i close the MDI Main ??

2. When I opened a MDI child inside the MDI main and i try to open another
one without closing the first one! And then i try to click the menu button
that load the first form ... It's wont bring it to the front . I have to
close the sencond form the preview the first mdi child .. Can i make it
bring to the front when i click the menu that load the form?

Edwin



Mon, 04 Feb 2002 03:00:00 GMT  
 form close upon MDI form

Quote:
> 1. When I open a non child form and i close the MDI main form the non
child
> will keep open until i close it!! how can i close all the non child ,
> toolbox ... etc . when i close the MDI Main ??

Add:

Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)

    Unload frmNonChildFormName'Name of your non child form

End Sub

Quote:
> 2. When I opened a MDI child inside the MDI main and i try to open another
> one without closing the first one! And then i try to click the menu button
> that load the first form ... It's wont bring it to the front . I have to
> close the sencond form the preview the first mdi child .. Can i make it
> bring to the front when i click the menu that load the form?

What's the code behind the 'Menu Button'... Are you using the 'WindowList'
property in the menu?


Quote:
> I have a MDI form and some MDI child but some are non child. I got 2
> problems.

> 1. When I open a non child form and i close the MDI main form the non
child
> will keep open until i close it!! how can i close all the non child ,
> toolbox ... etc . when i close the MDI Main ??

> 2. When I opened a MDI child inside the MDI main and i try to open another
> one without closing the first one! And then i try to click the menu button
> that load the first form ... It's wont bring it to the front . I have to
> close the sencond form the preview the first mdi child .. Can i make it
> bring to the front when i click the menu that load the form?

> Edwin



Mon, 04 Feb 2002 03:00:00 GMT  
 form close upon MDI form

Quote:
> Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)

>     Unload frmNonChildFormName'Name of your non child form

Is that how many forms I have , I need to close  all of them , what about if
the form is not opened? Say I have 10 non MDI forms , I have to unload every
time the MDIform close????? Is this too silly?? Any more fexible one?

Quote:
> What's the code behind the 'Menu Button'... Are you using the 'WindowList'
> property in the menu?

It's just like:
mdichild.show <--it doesnt bring up the form that at the back of the current
mdichild

Edwin



Tue, 05 Feb 2002 03:00:00 GMT  
 form close upon MDI form
Hi Edwin:

Quote:
>1. When I open a non child form and i close the MDI main form the non child
>will keep open until i close it!! how can i close all the non child ,
>toolbox ... etc . when i close the MDI Main ??

When your main form unloads, you can loop through the forms collection and
unload all other forms, i.e.

Private Sub MDIForm_Unload(Cancel As Integer)
   Dim frm As Form
   For Each frm In Forms
      Unload frm
   Next frm
End Sub

Quote:
>2. When I opened a MDI child inside the MDI main and i try to open another
>one without closing the first one! And then i try to click the menu button
>that load the first form ... It's wont bring it to the front . I have to
>close the sencond form the preview the first mdi child .. Can i make it
>bring to the front when i click the menu that load the form?

I don't quite understand what you are saying.  Are you saying that you have
a separate menu item for each child form?

Doug.



Tue, 05 Feb 2002 03:00:00 GMT  
 form close upon MDI form
Quote:
> >2. When I opened a MDI child inside the MDI main and i try to open
another
> >one without closing the first one! And then i try to click the menu
button
> >that load the first form ... It's wont bring it to the front . I have to
> >close the sencond form the preview the first mdi child .. Can i make it
> >bring to the front when i click the menu that load the form?

 I don't quite understand what you are saying.  Are you saying that you have

Quote:
> a separate menu item for each child form?

Thanks for your help, the second question is about I got a menu bar that
click on diff. menu items will pop/load a specify form let's say i click the
button one to load the MDIchildform1 and then we didnt close the MDI1 and
click another button to load MDI2 ... after that we click back the button to
load the MDI1(actually just bring it to the front) ... but it still stay at
behind of the MDI2.That's what my problem.

Edwin



Wed, 06 Feb 2002 03:00:00 GMT  
 form close upon MDI form
Hi Edwin:

Quote:
>after that we click back the button to
>load the MDI1(actually just bring it to the front) ... but it still stay at
>behind of the MDI2.That's what my problem.

Post the code you are using to do this -- it sound to me like that may be
where the problem is.

In any case, something like this should work:

Private Sub mnuMDI2_Click()
   frmMDI2.Show
End Sub

Doug.



Wed, 06 Feb 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

2. How to prevent user closing a mdi form using the close control button

3. Passing Data From A Form To A Different Table Upon Close

4. Modifying object in MDI Parent form from MDI Child form

5. Non-MDI form to MDI form

6. Make a reference to a MDI form with a reference of a MDI child form

7. MDI-Child form and positon on MDI-form

8. Developing OLE MDI Child forms displayed on Control MDI Form

9. MDI child forms on top of a picture on a MDI form

10. Help with MDI Forms and MDI child forms

11. Modal non MDI forms and Modeless MDI child forms in VB 5.0

12. Q:non-MDI form to update MDI form

 

 
Powered by phpBB® Forum Software