Re: system IO exception when trying to kill an image file.
- From: Patrick Steele [MVP] <patrick@xxxxxxxx>
- Date: Mon, 15 Aug 2005 10:40:13 -0400
In article <C48C09E9-AEEF-4D7E-BF32-9396BF0BCEF9@xxxxxxxxxxxxx>,
Scott@xxxxxxxxxxxxxxxxxxxxxxxxx says...
> I am running into a problem with my code and can't seem to figure out the
> solution.
> I know it has to do with the pciture box control and unloading the image
> inthe picture box but I can't seem to figure out the correct way to "unload"
> the file.
> I have a simple form with a picture box and a button. I am using dir() to
> get all the the .tif files and display them in the pciture box. Each time the
> button it pressed it displays the next TIF image and then tries to kill() the
> previous TIF file. Attempting to kill the TIF file produces an IO exception
> that "The process cannot access the file becasue it is being used by another
> process".
Try disposing of the Image object used by the PictureBox before
deleting:
PictureBox1.Image.Dispose()
--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
.
- Follow-Ups:
- References:
- Prev by Date: Re: How to convert byte() to string, and from string back to byte()
- Next by Date: Re: get the username associated with a process
- Previous by thread: system IO exception when trying to kill an image file.
- Next by thread: Re: system IO exception when trying to kill an image file.
- Index(es):