Click here to Skip to main content
16,004,778 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to open Child window in parent window,C# windows Application?
Posted
Updated 12-Feb-12 19:12pm
v2
Comments
Sergey Alexandrovich Kryukov 13-Feb-12 1:05am    
How can you imagine that?
--SA
Varun Sareen 13-Feb-12 1:13am    
Edited for: Removed pre tag.

chk this link from codeproject

Creating MDI application using C# (Walkthrough)[^]
 
Share this answer
 
Comments
Santoshrohin 13-Feb-12 4:32am    
Thanks Ani,
It workes
Aniket Yadav 13-Feb-12 4:33am    
It's my pleasure. Even I have also developed An MDI Application using this link
Hi friend,

Set ur Form property ISMDIContainer=true
 
Share this answer
 
There is no functional child-parent relationship between forms.

I mean, Form still have child-parent properties System.Windows.Forms.Control.Parent and System.Window.Forms.Control.Controls but these properties are made defunct if you try to make one form a child of another form. An exception will be thrown.

There is a work-around, but I would advise not to use it. You can assign Form.TopLevel property to false, and then such form could be inserted as a child of another form. It will look ugly. If the child form has non-client area, the parent form will go inside the parent form with all the non-client area.

Windows is not really designed to use such pathological things. This would violate most basic design principles. Also, this is never needed. For a children of the Form you can use other container controls like Panel, TabControl and the like.

Please see my past answer on this topic: Parent Child Form Relationship[^].

See also:

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.panel.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.aspx[^].

I did not mention a very different relationship: between MDI parent and MDI children. This is totally different story, but I don't recommend using MDI. It is highly discouraged even by Microsoft. You don't need to torture your head and scare off you users with this ugly style.

Please see:

http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
How to Create MDI Parent Window in WPF?[^],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^],
How to set child forms maximized, last childform minimized[^].

Some of my past answers are referenced above, I explain what can you do instead.
 
Share this answer
 
v3
Comments
Sergey Alexandrovich Kryukov 5-Mar-12 3:16am    
If the question is about MDI, I need to explain: MDIChild - MDIParent relationship is NET form child-parent relationship. And professional UI never uses MDI, it's highly discouraged.
--SA

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