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
 
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

 
Back
Top