Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Using an IF Statement to check Image in Picture Box

$
0
0
What I want to do is check a picture box. If it is one image, then I want it to do one action. If it is any other image, do a different action. I'm checking for an image located at My.Resources."image.png".

This is more or less what I want to accomplish (in pseudo code):


If PictureBox1 = (xxxx.png) Then

MsgBox(True)

Else

MsgBox(False)

End If




I have tried lots of things, these two were the ones I thought had the best chance of working:


If PictureBox1.Image = My.Resources."image.png" Then


This one spits out an error: (Operator '=' is not defined for types 'System.Drawing.Image' and 'System.Drawing.Bitmap')




If PictureBox1.Image.Equals(My.Resources."image.png") Then


This one just goes straight to the "Else" action, in other words, it doesn't recognise the image as the correct one, even when it is.



Thanks in advance,
Runos

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>