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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

minimize all forms related to a project

Status
Not open for further replies.

clientuser

Programmer
Apr 18, 2001
296
US
I would like to know how to minimize/maximize all forms in an open project. So if I have a main form open, when I minimize it, it minimizes itself and the other forms with it.

Also, when minimizing there would only be the main form in the taskbar and not any others that may be open with it.

Any suggestions?
 
You could create your main form as MDIForm and all other forms as MDI Child. This way, all child forms would be inside of the main form.
 
I made the forms I want child forms, but each time I start the main form and click to open one of the child forms, it gives me an error: No MDI form to load, error 366.

How do I set the main form as a MDI form?

Thanks for the help..........
 
vbpadawan's suggestion of using a MDI/Child form is the usual way to implement this type of app.

You cannot remove a form from the task bar at run time, the property ShowInTaskBar is design time only.

To minimize the forms you could add this to the main form.

Private Sub Form_Resize()

Dim frm As Form
If Me.WindowState = vbMinimized Then
For Each frm In Forms
If frm.Name <> Me.Name Then
frm.WindowState = vbMinimized
End If
Next
End If

End Sub
 
Right CLick on the project explorer, add MDIForm...
 
I tried that code, but it also puts all the forms in the taskbar when they minimize with the main form. I went and added the MDIform to the project using an existing form and then made some of the other forms MDIchild

But whenever I try to open up one of the MDIchild forms, it get the error: error 366, no MDI form available to load........

I thought by loading an existing form when it pulls up the selection to select the MDIform, that this was sufficient?

Am I missing something?
 
You need to actually add a new form. The new form must be the MDIForm. The MDIForm is a container for all the MDI Child forms. You can load your first form inside of the MDIForm when your application loads so your application looks the same. Let me know if you would like any help making it all work.
 
How do I take my current forms and put them into the new MDIform?

Sorry to ask so many questions, just have never worked with MDI forms before..........
 
Anyone know how to open your existing forms in a new MDI form?
 
yea, make the MDIChild property True for those regular forms which you want to come inside the MDIForm.

Ask as many questions as u want clientuser, we are here to help..
 
You can also use setParent API Function. using this function you can open forms in any control or form without using MDI. even in a frame or picture boxes.let me know If you have not solved the problem still, I will post the code to open forms in a main form using this API.

 
All you need to do is make sure that you have:

1) Set the startup form to the MDIForm
2) Set whichever forms to MDIChild

Try implementing a menu to test loading a child form and it will load inside the MDIForm (regardless of whether the MDIChild was added before or after the MDIForm was added).

The only other problem that I think you may be having is that you could be trying to open a child form before opening the MDIForm. Make sure that anytime you are opening a child form that the parent is open too (this is just in case you have a mix of MDIForm's, child forms and standard forms.)

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Is it really necessary MSM?

As i understand the parent form (MDIForm) loads automatically if its child is invoked..
 
vbSun - Sorry you are correct. I was thinking that this wasn't the case if there was a mix of all 3 (MDI, child and standard) but this isn't the case.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top