derekl
asked on
Form Disposal Question
I have a question about how and when an instance of System.Windows.Form get's disposed. Here is the scenario:
I created a form, showd it and then put a reference to said form in a hashtable. I then closed the form. When I later attempted to access the object through the hashtable I got an exception saying it had been disposed. Shouldn't the reference in the hashtable be sufficient to keep this form from being disposed? If not is there anyway to prevent the form from being disposed on closure? Finally if I can't prevent the disposal on closure is there any way to determin if a reference refers to an object which has been previously disposed?
I created a form, showd it and then put a reference to said form in a hashtable. I then closed the form. When I later attempted to access the object through the hashtable I got an exception saying it had been disposed. Shouldn't the reference in the hashtable be sufficient to keep this form from being disposed? If not is there anyway to prevent the form from being disposed on closure? Finally if I can't prevent the disposal on closure is there any way to determin if a reference refers to an object which has been previously disposed?
ASKER
Which event do I need to override to provide this behavior?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Smg.