M
Mugsy_in_Houston
Guest
I've written a utility that reads hundreds of icons from a folder, puts them in an Image array, and displays each in a PictureBox. One of the features I wish to add is the ability to delete selected icons on command. But when I try, I get a "File is in Use" error
I set the specified image array entry to "Nothing" but that didn't help. So I added a ".dispose" method immediately after that just gives me an error:
(The Form_Load contains):
myBitmap = Image.FromFile(strIconPath & "Save\" & strCategory & Format(intCnt + 1, "00") & ".png")
myThumbnail = myBitmap.GetThumbnailImage(256, 256, myCallback, IntPtr.Zero)
thumbnails(intCnt).Image = myThumbnail
[...]
thumbnails = New PictureBox() {picThumb01, picThumb02, picThumb03, picThumb04, picThumb05,
[...]
picThumb195, picThumb196, picThumb197, picThumb198, picThumb199, picThumb200}
If I put the Dispose() before the "Nothing" assignment, I get a "File Open" error. If I remove the "Nothing" assignment entirely, I get the same "File In Use" error as before. I've even tried replacing the displayed icon to another image, but I still get a "File In Use" error.
I have no idea what I must do to release the image so I can delete it. All online searches say to use "Dispose", but I already am.
TIA
Continue reading...
I set the specified image array entry to "Nothing" but that didn't help. So I added a ".dispose" method immediately after that just gives me an error:
(The Form_Load contains):
myBitmap = Image.FromFile(strIconPath & "Save\" & strCategory & Format(intCnt + 1, "00") & ".png")
myThumbnail = myBitmap.GetThumbnailImage(256, 256, myCallback, IntPtr.Zero)
thumbnails(intCnt).Image = myThumbnail
[...]
thumbnails = New PictureBox() {picThumb01, picThumb02, picThumb03, picThumb04, picThumb05,
[...]
picThumb195, picThumb196, picThumb197, picThumb198, picThumb199, picThumb200}
If I put the Dispose() before the "Nothing" assignment, I get a "File Open" error. If I remove the "Nothing" assignment entirely, I get the same "File In Use" error as before. I've even tried replacing the displayed icon to another image, but I still get a "File In Use" error.
I have no idea what I must do to release the image so I can delete it. All online searches say to use "Dispose", but I already am.
TIA
Continue reading...