Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5952573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:42:03+00:00 2026-05-22T17:42:03+00:00

I have 3 forms on my project. form1 is MDI controller form2 and form3

  • 0

I have 3 forms on my project.

  • form1 is MDI controller
  • form2 and form3 are MDI children

How do I create form1 as the parent and form2 and form3 as children?

Something like old MFC’s MDI interface:

enter image description here

Imagine form2 is the parent and has a button. If clicked, it must open form3 in the parent form (form1). How do I set this up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:42:04+00:00Added an answer on May 22, 2026 at 5:42 pm

    Firstly, make sure Form1’s IsMdiContainer is set to true.

    Then instantiate Form1 and Form2, setting Form1 to be Form2’s MdiParent:

    // Form1.IsMdiContainer should be true
    Form1 form1 = new Form1();
    
    // This automatically adds form2 into form1's MdiChildren collection
    Form2 form2 = new Form2();
    form2.MdiParent = form1;
    

    In Form2’s code, have something like the following to handle the button’s click event to instantiate Form3.

    public class Form2 : Form {
        // Include as data member so we only instantiate one Form3
        Form3 _form3;
    
        public Form2() {
            InitializeComponent();
            Button1.Click += new EventHandler(Button1_Click);
        }
    
        private void Button1_Click(object sender, EventArgs e) {
            if(_form3 == null) {
                _form3 = new Form3();
                // Set Form3's parent to be Form1
                _form3.MdiParent = this.MdiParent;
            }
        }
    }
    

    As a couple notes, this code is really quick and dirty. There are several undesirable things about it like the coupling of Form2 and Form3 (as well as unhelpful class names Form1, Form2, and Form3). Ideally, you’d decouple Form2 and Form3 by raising an event from Form2 that your forms container can hook onto and instantiate Form3. This sample code is meant to give you a direction.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 3 forms in my project form1 , form2 , form3 and it
Very periodically, some of our forms in our MDI vb.net project will return me.parent
I would like to use log4j.net in my windows forms project. However I have
I have a Windows forms project and a Web Service project in my solution,
I have a VB.NET Windows Forms project that at one point paints text directly
I have a treeview control in a Windows Forms project that has checkboxes turned
I have a windows forms (.net 3.0) project that won't run on my customer's
I have been working on a project that has 2 interfaces - windows forms
I have a project with a main MDI form. There is a child MDI
I have asked the question Is there something like master page in desktop applications?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.