jmsloan
asked on
Type mismatch error
Can someone tell me how I can get this to work. I am getting a type mismatch error right now.
Public myForeColor As String
myForeColor = "&HFFFF&"
label1.ForeColor = myForeColor
Public myForeColor As String
myForeColor = "&HFFFF&"
label1.ForeColor = myForeColor
Hi jmsloan;
ForColor is of type Color and not String. The following should do what you want.
Public myForeColor As Color
myForeColor = Color.FromArgb(255, 0, 255, 255)
label1.ForeColor = myForeColor
Fernando
ForColor is of type Color and not String. The following should do what you want.
Public myForeColor As Color
myForeColor = Color.FromArgb(255, 0, 255, 255)
label1.ForeColor = myForeColor
Fernando
forecolor is a system drawing color.
try playing with
scColor As New System.Drawing.ColorConver ter
and
System.Drawing.ColorTransl ator.FromW in32(yourv alue)
greg
try playing with
scColor As New System.Drawing.ColorConver
and
System.Drawing.ColorTransl
greg
ASKER
I forgot to mention I am using VB6
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think this is correct
Public myForeColor As Long
' RED, GREEN, BLUE
myForeColor = RGB(0, 255, 255)
label1.ForeColor = myForeColor
This value HFFFF is the same as H00FFFF = RED = 0, GREEN = 255, BLUE = 255
Public myForeColor As Long
' RED, GREEN, BLUE
myForeColor = RGB(0, 255, 255)
label1.ForeColor = myForeColor
This value HFFFF is the same as H00FFFF = RED = 0, GREEN = 255, BLUE = 255
System.Drawing.ColorConver
label1.ForeColor = (System.Drawing.Color) cc.ConvertFromString("#FF0