TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ankush
NA
267
63.2k
Close the second child form if one form is already open
Feb 8 2016 1:42 AM
I have created windows application in which there is a parent form with many child forms. Now what I want to do is, Close the second form if first form is opened. I have menustrip control, that is disabled once any form is opened and enabled if form is closed. Now I have added shortcut keys in menu strip for opening the forms. By using the shortcut I open the first form, then again by using shortcut, the second form is opened and the first form is closed instead of second form.
The code I wrote :-
void MDIParent1_MdiChildActivate(object sender, EventArgs e)
{
if (this.MdiChildren.Count() > 1)
{
foreach (Form childForm in this.MdiChildren)
{
if (childForm != this.ActiveMdiChild)
{
childForm.Close();
return;
}
}
}
}
Thanks in Advance !!!!
Reply
Answers (
1
)
Generate Excel file readonly using c#.net
How to display and store app rating my google circle friends