Owned Forms issue
-
Hi all, To be precise, I have a winform (say form A) with buttons on it, which when clicked, opens up new forms (say b, c, d). I want to set form A as the owner and forms b,c,d as owned forms of form A. The basic thing which I am looking to achieve is that when I close form A , I want to close all other owned forms and warn the user that some forms that belong to form A are already open and if they would like to close it? FYI - form A is already a ChildForm of a MDI parent in my application. Any help will be appreciated. Thanks,
-
Hi all, To be precise, I have a winform (say form A) with buttons on it, which when clicked, opens up new forms (say b, c, d). I want to set form A as the owner and forms b,c,d as owned forms of form A. The basic thing which I am looking to achieve is that when I close form A , I want to close all other owned forms and warn the user that some forms that belong to form A are already open and if they would like to close it? FYI - form A is already a ChildForm of a MDI parent in my application. Any help will be appreciated. Thanks,
Hi, inside class FormA, instead of doing
formB.Show()
orformB.ShowDialog()
, doformB.Show(this)
orformB.ShowDialog(this)
. :)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Hi, inside class FormA, instead of doing
formB.Show()
orformB.ShowDialog()
, doformB.Show(this)
orformB.ShowDialog(this)
. :)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
thanks for your reply, But the problem is, I want the form to be displayed within the MDI parent container. If I use Show() or ShowDialogue() the form is displayed outside the MDI parent container.
-
thanks for your reply, But the problem is, I want the form to be displayed within the MDI parent container. If I use Show() or ShowDialogue() the form is displayed outside the MDI parent container.
then try something like this:
FormB formB = new FormB();
formB.MdiParent = this;
formB.Show();:)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
then try something like this:
FormB formB = new FormB();
formB.MdiParent = this;
formB.Show();:)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Hi thanks for your reply. Am getting this exception error when I write Ur code. "Form that was specified to be the MdiParent for this form is not an MdiContainer. Parameter name: value "
-
Hi thanks for your reply. Am getting this exception error when I write Ur code. "Form that was specified to be the MdiParent for this form is not an MdiContainer. Parameter name: value "
then fix the error. stuff the parent where it goes. :|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
then fix the error. stuff the parent where it goes. :|
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Mate, This is the hierarchy of my app. MDIParent > MDIChild > buttons to open additional forms. these forms appear in the MDI Container if I set
form.MDIParent = this.MDIParent
But my question is When I close the child form, I want to close all other open forms which are opened through button clicks?
-
Mate, This is the hierarchy of my app. MDIParent > MDIChild > buttons to open additional forms. these forms appear in the MDI Container if I set
form.MDIParent = this.MDIParent
But my question is When I close the child form, I want to close all other open forms which are opened through button clicks?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
Thats the whole issue mate. If I say
Show(this) or ShowDialog(this)
I get the error which says "Form that is not a top-level form cannot be displayed as a modal dialog box. Remove the form from any parent form before calling showDialog." Ohh I better ask Uncle Google instead. Cheers
-
Hi thanks for your reply. Am getting this exception error when I write Ur code. "Form that was specified to be the MdiParent for this form is not an MdiContainer. Parameter name: value "
you need to set the
IsMdiContainer
(IIRC) property to true in the parent form.Dave
If this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)