Translate

How to disable parent when child window is opened in visual C#

To create a child form (child window) , you can do like this:

MyChildForm childForm = new MyChildForm();
childForm.Show();
 where 'MyChildForm' is the name of child window. This code will open a new child window. But both child and parent forms are accessible in this method. Suppose if you want to display an about box or settings window, you have to disable parent window when child is opened. To do that you have to change the above code like this, 
MyChildForm childForm = new MyChildForm();
childForm.ShowDialog(this);
 (where 'this' denotes the parent form)

Categories: ,

Leave a Reply