Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi, is it possible to put an MDI container within an MDI container? so Container 2 would be a child of container 1.

I am making a calorie/food application and need multiple forms popping up, for example I have a splash screen on load which leads to a "Welcome and login" page from there I open a mdi container. Within the container I want to be able to load a form, so enter details, then instead of going back to the container and loading a new child is it possible to have container within container within container?

thanks in advance

Dan
Posted
Comments
Philippe Mori 26-Dec-14 21:16pm    
The first thing would be to try existing application (Outlook, Internet Explorer, Control Panel, Visual Studio...) and try to see which one is closer of what would be appropriate for your application.

Bad idea, really bad! I don't think it's possible and I would not recommend you using MDI at all; this style is highly discourages (first of all, my Microsoft where MDI was introduced).

See also:
Question on using MDI windows in WPF[^],
MDIContainer giving error[^].

[EDIT]
Answering the follow-up question:

Please see my design recommendation in my past answer:
GUI Apperance - C#.Net[^].

—SA
 
Share this answer
 
v2
Comments
Wonde Tadesse 24-May-11 21:29pm    
Good answer. 5+
Sergey Alexandrovich Kryukov 24-May-11 21:34pm    
Thank you, Wonde.
--SA
DanHodgson88 24-May-11 22:51pm    
thanks for your reply. I am totaly new to c#, I am a student learning c# as an extra language. The windows forms do seem to be confusing me abit and causing me all sorts of problems. for the application I have briefly explained what kind of structure would you suggest to use. Thanks again for your reply
Sergey Alexandrovich Kryukov 24-May-11 23:03pm    
Again, I suggest to use TabControl on top level. Add Main menu to top, status bar on button, the middle fill with TabControl (with Dock=DockStyle.Fill). Now, levels of hierarchy should have visual feedback. If you wanted deeper hierarchy, here is another pattern: inside a tab page: ListBox or ViewBox on left, selection of items controls what's on right, splitter in between. You can re-populate controls on right of have N Panels, N+1 hidden, one -- visible according the the selected item on left. Thoroughly automate all that.

How about it? Can be more scenarios. Do yourself a favor, no MDI (and no many forms in SDI style; this is better but also not so good).
--SA
Sergey Alexandrovich Kryukov 24-May-11 23:06pm    
Please see also my updated answer after [EDIT]
--SA
First, it's a bad idea. Second, the MDI model doesn't support it. A MdiChild cannot also be an MdiParent at the same time.

The MDI model (Multiple Document Interface) was setup to have the same document editor type for each MdiChild child. It is not meant for hosting all kinds of disparet forms. From your description, you're not really talking about an MDI application at all.
 
Share this answer
 
Comments
DanHodgson88 24-May-11 22:49pm    
thanks I appreciate your reply. As you can tell im new to c# and to be honest using visual studio is not helping, there seems to be so many (Wrong) ways to do very similar things. What kind of structure would you suggest for such an application?
It's not possible for a MDI Parent to also be a MDI Child.

If you're thinking of doing something like this, you really shouldn't be using MDI at all.
 
Share this answer
 
trrytrrtyrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddydrt
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900