Loading image from file

S

Simon Jefferies

Hello,

I am trying to load an image from a file and put the image into a picturebox
with the following code:

Dim ImgThumbnail As System.Drawing.Image =
picImage.Image.FromFile(Filename).GetThumbnailImage(picImage.Width,
picImage.Height, Nothing, Nothing)
picImage.Image = ImgThumbnail.Clone
ImgThumbnail.Dispose()

The problem I am having is that it locks the file. Is there anyway to
release the lock on the file?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:[email protected]
www.headfirst.co.uk www.callofcthulhu.com
-
 
S

Sven Groot

Simon said:
Hello,

I am trying to load an image from a file and put the image into a
picturebox with the following code:

Dim ImgThumbnail As System.Drawing.Image =
picImage.Image.FromFile(Filename).GetThumbnailImage(picImage.Width,
picImage.Height, Nothing, Nothing)
picImage.Image = ImgThumbnail.Clone
ImgThumbnail.Dispose()

The problem I am having is that it locks the file. Is there anyway to
release the lock on the file?

Dim Img as System.Drawing.Image = System.Drawing.Image.FromFIle(Filename)
Dim ImgThumbnail As Image = Img.GetTumbnailImage() ' parameters omitted
Img.Dispose()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top