We help IT Professionals succeed at work.

C# Mdi application with child forms

smm57 asked
I am a newbie as far as doing Windows Foirms apps and I want to develop an MDI app in C# that has a "main form" with well defined sub form sections such that when I press a button on one child form it cause the exisiting child form to be replaced with another. I looked at articles on topics such as Newing up a form instance and setting it to be the child of the parent (main form). Is ther some resource where I could learn this via a book or a tutorial online? As I a said I am a newbie. The app I have thus far has the main form open and it has the two buttons that I added. Ideally I will have the child forms reside only in a sub section of the entirte form for the application such that one part of the main form has a list box that remains on the GUI regardless of what sub (child form) I have loaded, I hope I have provided enough information to ask "my question" well enough, thanks in advance for any help.
Watch Question


The way I have it now, the child forms appear on top of the GUI but the two buttons on the main parent window still show up such that the child seems "see thru".
Mike TomlinsonHigh School Computer Science, Computer Applications, Digital Design, and Mathematics Teacher
Top Expert 2009
You can embed a Form in a container such as a Panel by setting TopLevel() to false:
Use the ActivateMdiChild method on the form marked as MdiContainer
You might need to maintain a list of mdi childs on the conainer form to allow this.

MDI is documented in http://msdn.microsoft.com/en-us/library/xyhh2e7e%28v=VS.100%29.aspx
or related pages in the menu on the left, including good examples. Be sure to select the appropriate .Net Framework at the top of the page.