How to disable a parent form when child form is active using c#?
For me this work for example here what happen is the main menu will be disabled when you open the registration form.
frmUserRegistration frmMainMenu = new frmUserRegistration();
frmMainMenu.ShowDialog(this);
Have you tried using Form.ShowDialog() instead of Form.Show()?
ShowDialog shows your window as modal, which means you cannot interact with the parent form until it closes.
Why not just have the parent wait for the child to close. This is more than you need.
// Execute child process
System.Diagnostics.Process proc =
System.Diagnostics.Process.Start("notepad.exe");
proc.WaitForExit();
Its simple, use
Form.ShowDialog();
Instead
Form.Show();
While using Form.ShowDialog()
you cannot interact with the parent form until it closes.
You can also use MDIParent-child form. Set the child form's parent as MDI Parent
Eg
child.MdiParent = parentForm;
child.Show();
In this case just 1 form will be shown and the child forms will come inside the parent. Hope this helps
You can do that with the following:
Form3 formshow = new Form3();
formshow.ShowDialog();