Listboxs and objects they hold

  • Thread starter Thread starter Poohface
  • Start date Start date
P

Poohface

I'm using a listbox to hold objects. The objects are a class I made.
Allis well except when I do a listbox.items.clear, it clears the
listbox, but judging by the mem usage climb each time I re-populate
the listbox, it does not look like the previsous objects are being
destoryed. I had assumed that when the items object collection was
cleared that the objects would be destroyed. Am I wrong? Is this my
fault, should I have something in my class to destroy them?

Norst
 
ok I confirmed what I thought, the objects are not being destroyed, I
added the following to my class:

Protected Overrides Sub finalize()
Debug.Write("Class Killed" & vbNewLine)
MyBase.Finalize()
End Sub

when I clear the list box they are not killed. Thier death does not
occur untill the app is terminated. So I need to find a way to have
the destruction occur when the listbox.item.clear happens.

Thanks for any help,
Norst
 
Back
Top