[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 601
  • Last Modified:

How do I open forms in a tabbed windows form c#.Net

I have a main form which i have set it as "isMdiContainer = true" and I am opening other windows forms in it. I want to display the forms that are opened in a tabbed format, i.e. if i have 3 forms opened, i will have 3 tabs, one for each form.

An example of how i need to display the forms is shown in the picture below.

Any help please?

Thanks
untitled.JPG
0
imaginecup
Asked:
imaginecup
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Then you don't really need an MDI container form...

...anyhoo, here is an example of opening up Form2 inside tabPage1.  Note the key here is setting the Forms TopLevel() Property to False:
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            f2.FormBorderStyle = FormBorderStyle.None;
            f2.Dock = DockStyle.Fill;
            f2.TopLevel = false;
            tabPage1.Controls.Add(f2);
            f2.Show();
        }

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now