Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Public forms all over the project

Status
Not open for further replies.

vtops

IS-IT--Management
Oct 13, 2005
63
GR
Dear All,


I have an mdi parent form with two chilldren. In the MDI parent form i have declare the chilldren like that:

public static Form2 frm2=new Form2();
public static Form1 frm1=new Form1();

and this is the Mdi Parent Form:
public static Parent frmparent =new Parent();

Now I am calling one Child from a menu of MDI parent like this:

Parent.frm1.Show();
The Form will be displayed fine but if i close the Form2 and call it again from parent's menu then i have the Exception:
System.ObjectDisposedException.

So the question is how can i have a variable which presenting a Form and be public all over the project everytime i want to open it?


Thanks
 
Either make it a singleton.

Or do this in the closing event.

e.cancel = true;
this.hide;

.

Christiaan Baes
Belgium

"My new site" - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top