-
disposing of a class
I've got a form that is declared as NEW at some point in my program. it has a list view and after the user selects something, the form closes itself (me.close).
the form is declared as MC = new formasdasd by the way.
after it closes itself, would the sub that instantiated it be responsible for destroying MC? or, could I code a custom 'dispose' property and when the 'closing' event is fired, have the dispose go into action?
-
Implement the IDisposable interface in your form and do your own dispose... I read somewhere that this is recommended...
Seriously, I never really cared about disposing of my forms when they close because the real memory free happens when the garbage collector collects your closed form... and you never know when this will happen...
-
hmm. ok. but, just simply closing the form takes it out of memory EVENTUALLY? I just don't want a ton of new instances of the form piling up in the stack and my app to start getting sluggish.