|
-
August 23rd, 2005, 01:18 AM
#1
Try to delete a picture file which is loaded in picturebox
Hi,
i tried to delete a picture file which is loaded in picturebox using system.io.file.delete method it gives error that "It being used by another Process".
How to overcome this error. still i used picturebox =null
Regards,
Sivakumar.kr
-
August 23rd, 2005, 02:21 AM
#2
Re: Try to delete a picture file which is loaded in picturebox
The help documentation clearly states that if you have created an Image object by calling Image.FromFile then that file is locked until the Image object is Disposed. This means that you need to call Dispose on the PictureBox.Image to release the file. You can use Image.FromStream to create an Image without locking the file in the first place.
-
August 23rd, 2005, 02:31 AM
#3
Re: Try to delete a picture file which is loaded in picturebox
jmcilhinney is correct, here is another alternative...something similar on another thread
Useful? Then click on (Rate This Post) at the top of this post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|