M
Mugsy_in_Houston
Guest
I need to replace the image in one Picture Box with another. That means I must Dispose of the target before replacing it. Sometimes, that box contains a "default" ("No") image if blank. Unfortunately, if the program tries to replace the default/"No" with the same default/"No" image, disposing of the target disposes of the source!
How can I compare the source & target image to see if they are the same image? I can't find a method that gives me the filename of the image in a PicBox, so I can't identify the image by name.
I tried using the ".Tag" property to tag the source, but it only tags the PicBox itself, not its contents. So when I try reading the tag of the copy, the value is "Nothing".
' Defined an array of images for each icon called "thumbnails" earlier in the program.
Try
If thumbnails(intItem1).Image.Tag <> picBlank.Image.Tag Then ' This does not work, and trying to compare .image alone is invalid.
thumbnails(intItem1).Image.Dispose() ' Must dispose before we can modify.
End If
Catch
' Empty slots don't need to be disposed of. Ignore.
End Try
[...]
thumbnails(intItem1).Image = picBlank.Image ' (Results in "invalid parameter" error when the images are the same file.)
How can I obtain some unique identifying information about the source & destination PicBox contents to see if they contain the same image?
TIA
Continue reading...
How can I compare the source & target image to see if they are the same image? I can't find a method that gives me the filename of the image in a PicBox, so I can't identify the image by name.
I tried using the ".Tag" property to tag the source, but it only tags the PicBox itself, not its contents. So when I try reading the tag of the copy, the value is "Nothing".
' Defined an array of images for each icon called "thumbnails" earlier in the program.
Try
If thumbnails(intItem1).Image.Tag <> picBlank.Image.Tag Then ' This does not work, and trying to compare .image alone is invalid.
thumbnails(intItem1).Image.Dispose() ' Must dispose before we can modify.
End If
Catch
' Empty slots don't need to be disposed of. Ignore.
End Try
[...]
thumbnails(intItem1).Image = picBlank.Image ' (Results in "invalid parameter" error when the images are the same file.)
How can I obtain some unique identifying information about the source & destination PicBox contents to see if they contain the same image?
TIA
Continue reading...