image file locked after use

T

thebhone

I am creating a website updater program. Currently working on the image

replacement module here.

For some reason, after an image (say /images/1.jpg) has been
used/opened in the application. I cannot later overwrite it (during the

application), even after i have closed it.


"My.Computer.FileSystem.CopyFile(OpenFileDialog1.FileName,
"\images\posters\" & Me.imagenum & ".jpg", True)"


The process cannot access the file 'C:...\images\posters\1.jpg' because

it is being used by another process.


Is there a way to unload this image so that I can overwrite it? As soon

as my application quits, the lock is removed. I can tell that my
program is locking the file, but the image is not being displayed or
used at that time!!


Form3.PictureBox1.Image = System.Drawing.Bitmap.FromFile(imgpath)

is how it is being loaded.


is there a way to unload that? / free up the resource for
editing/deletion.

another way to do what i'm trying?






please help,


Thanks,


Ted
 

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