Click here to Skip to main content
15,867,834 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
how to display a form as a child when it is requested by an another child form within the same mdi form??
give me a sloution please with code
Posted
Comments
Kenneth Haugland 1-Aug-12 7:39am    
Dont ask the same question twice, use the Improve question instead.
Sandeep Mewara 1-Aug-12 7:59am    
Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it's not that hard.
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.

1. People here don't like to write other people's homework.
2. It is very rude make requests.
3. Your problem is very straightforward, so this is the general idea:
C#
//******************************************
//          inside child form
//******************************************
this.MdiParent.ShowAnotherChild(formKey);

C#
//******************************************
//          inside mdi parent form
//******************************************

//I find it easier to work with dictionary than with existing MdiChildren property
Dictionary<sting,form> _mdiChildren = new Dictionary<string,form>();

void ShowAnotherChild(string formKey)
{
    if(!_mdiChildren.ContainsKey(formKey))
    {
        AnotherChild newChild = new AnotherChild();
        //...
        //code to configure a new form as a mdi child goes here
        //...
        _mdiChildren.Add(formKey, newChild); 
    }

    _mdiChildren[formKey].Show();
    _mdiChildren[formKey].BringToFront();
}


Try to work it out by yourself from here.
 
Share this answer
 
v2
Comments
Jαved 1-Aug-12 5:02am    
+5.
Oshtri Deka 1-Aug-12 5:23am    
Thank you.
 
Share this answer
 
You might befifit from reading this article from CodePRoject:
Introduction to MDI Forms with C#[^]
 
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