Checking PicBox Color

Jay1b

Contributor
Joined
Aug 3, 2003
Messages
640
Location
Kent, Uk.
I am trying to check on the color of a pic' box using an if statement, but it doesnt like it, apparently = isnt a valid operator for for system.drawing.color.

It works fine when i am trying to set the color, just not when i am using it in an if statement.

Visual Basic:
If picRX.BackColor = Color.Green Then MsgBox("")


Thanks.
 
I really thank you for asking this question i was surprised to see that it doesnot work, neither the Is operator works too.

I digged up a little, and found that to compare colors you should use the equals method of the color.

In your case
If picRX.BackColor.Equals(Color.Green) Then

Cheers,
 
errr...its no problem :)

It should be me doing the thanking, as you helped me out, not vice-versa, so Thank you.

How come everyone else can always find the answers, and i spend 30 mins or so on google, getting absolutely nowhere? :(

Cool James Dean quote by the way.
 
Well i searched for 2 minutes on google and didnot find it, so ichecked MSDN help inside visual studio .NET ;)
 
I used to find that brilliant in VB6 and below, but it never seems to find anything in vb.net anymore - but perhaps its the way i am just doing it. :(
 
Back
Top