Is thsi OK or do I need a Dispose

  • Thread starter Thread starter active
  • Start date Start date
A

active

Private Sub AdjustBitmap()

If b1 Is Nothing Then Exit Sub

Dim b = New Drawing.Bitmap(picData.Width, picData.Height)

Dim g As Graphics = Graphics.FromImage(b)

g.DrawImage(b1, 0, 0)

b1 = b

g.Dispose()

End Sub

Is the above OK? I think I need to Dispose the old Bitmap but don't know
how.

Do I need to Dispose it or will garbage collection take care of it?

If I do, how. Would the following be sufficient?

At the top add bb=b1

At the bottom add bb.Dispose



As always thanks for any helpful info,

Cal
 
* "Cor said:
Just to prevent for others to open it.

Maybe in your newsreader. In my newsreader there is no multipost answer
2 lines above.

;-)
 
Hi Herfried,
Maybe in your newsreader. In my newsreader there is no multipost answer
2 lines above.

We know about that gnu, but when you push in OE on that little - in the
first thread above this and than on that little - in the thread above that,
than you have a line that says
Is this OK or do I need a Dispose

Answered by: - AZ, HKW, C,

Cor
 
* "Cor said:
We know about that gnu, but when you push in OE on that little - in the
first thread above this and than on that little - in the thread above that,
than you have a line that says
Is this OK or do I need a Dispose

Answered by: - AZ, HKW, C,

Thank you!
 
Back
Top