Compare TextBox.backcolor with IF THEN Statement

swu

Active member
Joined
Mar 26, 2005
Messages
33
Programming Experience
1-3
I'm having a problem comparing TextBox back color of two text boxes. Vb.net will not let me compare them directly and I can't figure out how to set the color to a variable.

If TextBoxA.BackColor <> System.Drawing.Color.Gray Then
TextBoxB.BackColor = System.Drawing.Color.White
End If

Thanks in advance,

swu
 

tresqboy

Member
Joined
Sep 6, 2005
Messages
7
Location
Manchester NH/Boston MA
Programming Experience
3-5
Try Converting color to integer value

You can convert the color to Integer value using Color.ToArgb() function which will give you the colors'integer equivalent value

If
TextBoxA.BackColor.ToArgb <> System.Drawing.Color.Gray.ToArgb Then
TextBoxB.BackColor = System.Drawing.Color.White

End If

 
Top Bottom