i hav a menustrip and created mdi forms in this i hav child forms, i want to open one child form and hide the remaining child forms. Give me the solution for this question

Recommended Answers

All 9 Replies

check out the MDIChildren collection of the parent form. From this collection you can access the members of your child forms.

As an aside, its generally polite to ask for help rather than demanding a solution.

I am sorry sir actually am in tension so that i send that msg in that way . Once again i am telling very very sorry sir.

Its fine, I wasn't "telling you off" I was just pointing out that its good netiquette to ask, rather than demand :)

Did the MDIChildren collection help with your problem?

no sir, if i use that code parent form is closing but i want to show the parent form as well as child forms, if i click one child form from the menustrip and if i again click another child form from the menustrip first mdi form should hide and second form should be visible.Actually this is my question sir.Please help me sir. Thank u for giving the reply to me.

What code did you use? I suggested the collection but didnt say how to use it. Post the code you wrote that isnt working and we can help you to find the problem.
When you select a form you need to iterate through the MDIChildren collection and hide each form that isnt the one you have selected.

What code did you use? I suggested the collection but didnt say how to use it. Post the code you wrote that isnt working and we can help you to find the problem.
When you select a form you need to iterate through the MDIChildren collection and hide each form that isnt the one you have selected.

you give the code for my problem sir i will understand and i will convert it into my code. please sir give me the code for that problem

The policy here at daniweb is to help those who show effort. I have told you the collection you need to use...in your MDIParent form you would use this.MDIChildren.
Now either use a for or foreach loop to iterate through the forms in the collection. If a form is not the one you have selected then call .hide() on it.
Attempt to write the code then psot what you have and we will help you get it working.

The policy here at daniweb is to help those who show effort. I have told you the collection you need to use...in your MDIParent form you would use this.MDIChildren.
Now either use a for or foreach loop to iterate through the forms in the collection. If a form is not the one you have selected then call .hide() on it.
Attempt to write the code then psot what you have and we will help you get it working.

AdminSettings a = new AdminSettings();
a.MdiParent = this;
a.Focus();
a.Show();
this is code i have written in my child form similarly in another child form i.e. adminlogin in that i have written the same code. so if i open adminsetting form at the same time if i open adminlogin form adminsetting form should hide. This is my problem sir. please help me how to hide the first child form

when i open a child form remaining other child forms should be in lock please help me how it will happen

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.