Following on from my question here http://stackoverflow.com/questions/2548664/long-overdue-for-me-question-about-disposing-managed-objects-in-net-vb-net ,
If I replace an image in a picture box, should I dispose the original image first?
Or, what about this situation:
Dim bm As New Bitmap(32,32)
bm = New Bitmap(32,32)
bm = New Bitmap(32,32)
bm = New Bitmap(32,32)
Does bm need only to be disposed at the end, or should it be disposed before each re-creation?
Thanks all for the answers. A big oversight there on my part. I knew a control took care of disposing its children but It hadn't occurred to me that I should dispose an old image if I replaced it.