"In form" windows

Mat

Member
Joined
Jun 15, 2004
Messages
12
Programming Experience
10+
Hi everyone,

I'm currently trying to insert forms in one main form, I explain myself. I'm trying to do like in microsoft work where you can have multiple documents in one application. This way you can have 1 window in the taskbar below. Also, when I minimize my forms, it minimize in the currently main form, not minimize in the taskbar, so even if I have 3-4 open forms, the user see just 1 in the taskbar.

Could somebody help me to program this or which is the proprety of the form to do this.

Thank you very my
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
That type of app is called an MDI (Multiple Document interface) app.

VB.NET has made this fairly simple.
To start, set your main form's IsMdiContainer property to true. The main form would typically have only a MainMenu and perhaps some toolbars, although you could also dock a panel on the right with butons, ...
Next you would create another regular form, or multiple forms (the ones you want to open in the main form). To open the regular forms in the main form use code like this:

VB.NET:
Dim frm As New frmChild()
frm.MdiParent = Me
frm.Show()
where frmChild is the regular form.

Search MDI on this site for other examples.
 

mzim

Well-known member
Joined
Jun 3, 2004
Messages
187
Location
Other side of the rock
Programming Experience
1-3
Originally posted by Mat
so even if I have 3-4 open forms, the user see just 1 in the taskbar.
if you want to show that there is only 1 in the taskbar set the other forms in their property ShowInTaskbar = False..
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
An Mdichild by default is not shown in the taskbar. There is no need to set the ShowInTaskbar property to false. Try it and see :)
 

mzim

Well-known member
Joined
Jun 3, 2004
Messages
187
Location
Other side of the rock
Programming Experience
1-3
Paszt said:
An Mdichild by default is not shown in the taskbar. There is no need to set the ShowInTaskbar property to false. Try it and see :)
if it is show by default there is only one..
but if it is showdialog..it gives several window in the taskbar.:)
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
If you try to use the ShowDialog method on a form that is not a Top level form (i.e. an MdiChild) you'll get an exception. We are discussing MDI forms :)
 

mzim

Well-known member
Joined
Jun 3, 2004
Messages
187
Location
Other side of the rock
Programming Experience
1-3
Paszt said:
If you try to use the ShowDialog method on a form that is not a Top level form (i.e. an MdiChild) you'll get an exception. We are discussing MDI forms :)
tanx paszt...im sorry for being dump..:)
 
Top Bottom