Ahmed Moheb
Ahmed Moheb

Reputation: 762

can form Contain another form in winforms application?

i want to make one form contain another form ; For the sake of browsing different sub-forms in the same Parent Form using parent controls .

Upvotes: 0

Views: 1571

Answers (3)

Ahmed Moheb
Ahmed Moheb

Reputation: 762

Solution is to set the parent form property

IsMdiContainer = true ;

and set child forms with

childForm.MdiParent = parentForm;

Upvotes: 1

CC Inc
CC Inc

Reputation: 5918

You can use a TabControl to group different controls together, however if you REALLY need to have a subform, you can use MDI forms.

This is a tabcontrol:

enter image description here

It basically has a groupbox for each individual tab, so you can add and remove as you please.

From the docs for tabcontrol:

A TabControl contains tab pages, which are represented by TabPage objects that you add through the TabPages property. The order of tab pages in this collection reflects the order the tabs appear in the control. The user can change the current TabPage by clicking one of the tabs in the control.

And MDI:

Multiple-document interface (MDI) applications allow you to display multiple documents at the same time, with each document displayed in its own window. MDI applications often have a Window menu item with submenus for switching between windows or documents.

Upvotes: 1

Dale
Dale

Reputation: 1901

I believe that you are looking for TabControl in C#. This allows to to browse through different tabs in the same parent form. You may refer to TabControl in C# for more information.

Hope this helps.

Upvotes: 0

Related Questions