Link to home
Get AccessLog in
Avatar of developingprogrammer
developingprogrammer

asked on

&H and constants

hey guys i want to use a constant t orepresent my hex value. essentially i want to do something like the below.

how do i do it in the proper way? using constants to represent hex? thanks guys!!

Public Const chexDisabledBackColour     As String = "D3D3D3"
Public Const chexEnabledBackColour      As String = "FFFFFF"

Me.txtReason.BackColor = &HmodGenericResources.chexDisabledBackColour

Question
is this the only way? how do yall usually do it when you wanna use constants and hexadecimals?

     Function HexToLong(ByVal sHex As String) As Long
        HexToLong = Val("&H" & sHex & "&")
      End Function

http://support.microsoft.com/kb/161304
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
SOLUTION
Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
ASKER CERTIFIED SOLUTION
Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of developingprogrammer
developingprogrammer

ASKER

thanks Dave! i didn't know that previously! very good point you brought up!! = ))

thanks Christian! i didn't think of the - RGB function previously

thanks gustav! that was what i was looking for - for learning purposes. but i think i should just store it as a long next time cause the &H will cause a recalculation each time i use the constant if i'm not wrong! = )
You are wrong about that. A constant is - eh - constant.

/gustav
Oops you are right gustav!! Silly me!! Haha = )) thanks for clearing up my head!! = ))