can't delete file

  • Thread starter Thread starter Penk
  • Start date Start date
P

Penk

I need a form to delete an image that is shown in a control, to replace with
another image.
I tried changing the archive that is showing the control, closing the form
and then deleting the old image, but there's an error
because the system says that the archive is in use.
I need to replace this image, someone knows a way to close conections to the
archive, or something like this?
Thanks
 
Penk said:
I need a form to delete an image that is shown in a control, to replace
with
another image.
I tried changing the archive that is showing the control, closing the form
and then deleting the old image, but there's an error
because the system says that the archive is in use.
I need to replace this image, someone knows a way to close conections to
the
archive, or something like this?

\\\
Dim OriginalImage As New Bitmap("C:\WINDOWS\Angler.bmp")
Dim Image As New Bitmap(OriginalImage)
OriginalImage.Dispose()
..
..
..
Image.Dispose()
///

- or -

\\\
Dim ImageFile As New FileStream("C:\WINDOWS\Angler.bmp", FileMode.Open)
Dim Reader As New BinaryReader(ImageFile)
Dim ImageStream As New
MemoryStream(Reader.ReadBytes(CInt(ImageFile.Length)))
Reader.Close()
Dim Image As Image = Image.FromStream(ImageStream)
..
..
..
Image.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

Back
Top