System.IO.IOException (Picturebox)
-
I have an winforms application that lets a user click on a listbox which holds a list of images. When the user clicks on a list item the corresponding image is loaded into the picturebox using the picturebox.image.fromfile(CStr(lstBox.SelectedItem)) syntax. The user is able to click a delete button which should delete the currently viewable picturebox image. Before doing the delete I am calling the following methods: picturebox.Image.Dispose() picturebox.Image = Nothing picturebox.Image.fromFile("temp.gif") so that the image i want to delete is freed from system resources. I keep getting the following error "The process cannot access the file "image.jpg" because it is being used by another process" I have tried numerous things to get round this error. My code does not load any images anywhere else apart from the picturebox. Please can anyone help!
-
I have an winforms application that lets a user click on a listbox which holds a list of images. When the user clicks on a list item the corresponding image is loaded into the picturebox using the picturebox.image.fromfile(CStr(lstBox.SelectedItem)) syntax. The user is able to click a delete button which should delete the currently viewable picturebox image. Before doing the delete I am calling the following methods: picturebox.Image.Dispose() picturebox.Image = Nothing picturebox.Image.fromFile("temp.gif") so that the image i want to delete is freed from system resources. I keep getting the following error "The process cannot access the file "image.jpg" because it is being used by another process" I have tried numerous things to get round this error. My code does not load any images anywhere else apart from the picturebox. Please can anyone help!
This is a documented bug in the framework: VB.NET: http://support.microsoft.com/kb/309482[^] C#: http://support.microsoft.com/kb/311754[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer