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
Jeffrey Baidoo
NA
67
682
How to disable the MDIparent form when a child form is activ
Feb 1 2016 4:09 AM
Hi there
Am a new student in C# and am using Microsoft Visual C# 2013.
My aim is to
i. open a child form inside its MDIparent form
ii. disable the MDIparent form when the child form is active/opened
it was easier in VB.net with
frmStuDetails.ShowDialog()
I have tried
1.
MyChildForm childForm = new MyChildForm();
childForm.ShowDialog(this);
Result....but the problem is that the child form doesn't open within the MDIparent form/container
2.
under MDIparent call button
frmViewStuList childForm = new frmViewStuList(this);
childForm.Owner = this;
childForm.Show();
under child from Activated
if (this.Owner != null)
{
this.Owner.Enabled = false;
}
under child form Deactivate
if (this.Owner != null)
{
this.Owner.Enabled = true;
}
Result.....it makes the child form active but freezes the MDIparent when the child form closes
3.
ChildForm child = new ChildForm();
child.Owner = this;
child.Show();
// In ChildForm_Load:
private void ChildForm_Load(object sender, EventArgs e)
{
this.Owner.Enabled = false;
}
private void ChildForm_Closed(object sender, EventArgs e)
{
this.Owner.Enabled = true;
}
Result ....It seems to be the best option but the child form doesn't open within the MDIparent
Please help if you have any other idea
Thanks
Reply
Answers (
1
)
How to run a batch file from current directory?
I want to Create a windows based application in c# WinForms