Adding a MDI child directly when opening the application (.NET 6.0)

In .NET 6.0 adding a MDI child only seems to work after the MDI parent is loaded. Therefore add the MDI child creation code in the Shown event handler and all functions correctly.

    private void MDIParent_Shown(object sender, EventArgs e)
    {
       MDIChild child = new MDIChild();
       child.MdiParent = this;
       child.Show();
    }

MDIForm is a standard form, note that the MDIParent form needs the IsMdiContainer property set to true;

Lastest update in February 2023, inital post in February 2023

Write a comment

I appreciate comments, suggestions, compliments etc. Unfortunately I have no time to reply to them. Useful input will be used for sure!