How to properly open a Image using Bitmap Class and dispose it properly

damon88

Member
Joined
Nov 8, 2009
Messages
9
Programming Experience
3-5
I am looking for a code snippet which opens a image, creates a clone of this bitmap in memory disposes this opened image so that all handles are closed.

Usually we can open a bitmap using this

Dim MyBit as new bitmap("C:\Image file.bmp")
dim ClonedBit as bitmap = MyBit.clone
MyBit.dispose

the following code however keeps the Image File locked until the application is running, any suggestions how to dispose it properly. (So that no handle is left open )

Things already tried:
use dispose method of bitmap <= doesnt work (need to write implementation)
Using Block also doesnt work.
 
Back
Top