Click here to Skip to main content
15,070,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all i am comparing two objects in if condtion, but its showing some error this is my code here


VB
Dim red As Object = Global.Frogy_Main_Screen.My.Resources.Resources.red_chair

          Dim clkchr As Object = cb.BackgroundImage

          If clkchr = red Then
              MsgBox("Somehting")
          End If


here cb is my button control

i am facing this kind of error. the error is

"Operator '=' is not defined for type 'Bitmap' and type 'Bitmap'."

how shall i fix this error.
Posted
Comments
DaveAuld 22-Dec-10 11:36am
   
Have you tried if clkchr.equals(red) ?

You can use Object.Equals()
http://msdn.microsoft.com/en-us/library/system.object.equals.aspx[^]

Or you could implement it yourself (if needed):
http://msdn.microsoft.com/en-us/library/ms173147.aspx[^]

Good luck!
   
VB
if clkchr.Equals(red) then
    ...
end if


EDIT ==========

Oops, Dave got there 1st. :)

   
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900