How to use ShowDialog in the click event of menu item
-
How to make my form acts as a dialog box when it is called from a menu item. I could do this using
Form.ShowDialog()
within any event of any control on a form. But when I called this function on the click event of a menu item, I got the following exception:mad:. "Forms that are not top level forms cannot be displayed as a modal dialog. Remove the form from any parent form before calling showDialog"Mohamed Gouda Egypt
-
How to make my form acts as a dialog box when it is called from a menu item. I could do this using
Form.ShowDialog()
within any event of any control on a form. But when I called this function on the click event of a menu item, I got the following exception:mad:. "Forms that are not top level forms cannot be displayed as a modal dialog. Remove the form from any parent form before calling showDialog"Mohamed Gouda Egypt
Try: Form.ShowDialog(this); This will create a modal dialog form on top of the main form.
Jeff Clark Systems Architect JP Clark, INC. Columbus, Ohio
-
Try: Form.ShowDialog(this); This will create a modal dialog form on top of the main form.
Jeff Clark Systems Architect JP Clark, INC. Columbus, Ohio
Thanks Jeff . It did not work. But you helped me rethinking about my code and discover my fault :doh:. The problem was that I defined the
MdiParent
property of the dialog form to bethis
My code was some thing like this.MyDialogForm dialogForm = new MyDialogForm(); dialogForm.MdiParent = this; // This was my fault dialogForm.ShowDialog();
However, Thanks a lotMohamed Gouda Egypt