Preventing multiple instances of the window
-
Hi guys, I need your help in preventing multiple instances of the same window from opening in an MDI parent child window application ? Its urgent ...thanks ...
-
Hi guys, I need your help in preventing multiple instances of the same window from opening in an MDI parent child window application ? Its urgent ...thanks ...
-
My question is simple and straight..I want to prevent multiple instances of the same child window from opening i.e. only one instance of a window should open up when i select a certain menu option from the main menu. I hope i made myself clear this time..!!
-
My question is simple and straight..I want to prevent multiple instances of the same child window from opening i.e. only one instance of a window should open up when i select a certain menu option from the main menu. I hope i made myself clear this time..!!
-
One way can be: use frm.ShowDialog(); This way, unless you have not closed the current child form, you cannot open anyother. This might be a quick fix for your problem. If you don't want this you might have to google intensly :)
yeah..I have tried that approach, but as u say, i was not able to to open up any other window until i closed this one..but tht should not happen in an MDI windows application ..right ? Can Dispose() method help in this case?
-
Hi guys, I need your help in preventing multiple instances of the same window from opening in an MDI parent child window application ? Its urgent ...thanks ...
MDI Parent forms contain a collection of it's children (this.MdiChildren). Before you open a new instance of a form you could check this collection if your form exist and simply activate this instance.
-
yeah..I have tried that approach, but as u say, i was not able to to open up any other window until i closed this one..but tht should not happen in an MDI windows application ..right ? Can Dispose() method help in this case?
-
MDI Parent forms contain a collection of it's children (this.MdiChildren). Before you open a new instance of a form you could check this collection if your form exist and simply activate this instance.
Can you elaborate a bit more...thanks
-
Can you elaborate a bit more...thanks
I found the solutions mate: Form2 frm = new Form2(); if (MdiChildren.Length != 0) { for (int i = 0; i < this.MdiChildren.Length; i++) { if (this.MdiChildren[i].GetType().Name != "Form2") { frm.Show(); frm.MdiParent = this; } } } else { frm.Show(); frm.MdiParent = this; } PS: you will have to modify this the above is real quick and dirty. You will have to check this for each and every form you open. Cheers.