Results 1 to 3 of 3

Thread: disposing of a class

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    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?

  2. #2
    Junior Member
    Join Date
    May 2003
    Posts
    24
    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...

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width