I got the image in the resources in my project.
I assign the image to the button by using
btnViewProductRemove.Image = My.Resources.btnRemove
If btnViewProductRemove.Image.Equals(My.Resources.btnRemove) Then
My.Resources.btnRemove is a property that returns a new instance of an image every time. You could make it work by holding onto a reference of your resource images, but it’s kind of inappropriate to decide what to do based on a button’s image. The
Tag property would be marginally more appropriate: set
btnViewProductRemove.Tag = "remove" or
= "recover" at the same time as you set its image, then just compare that.
If CStr(btnViewProductRemove.Tag) = "Remove" Then ' Remove Else ' Recover End If
If you can, though, I’d try to make the Remove and Recover buttons two separate controls, with only one of them visible at a time.