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

Avatar of undefined
Last Comment
developingprogrammer

8/22/2022 - Mon
SOLUTION
Dave Baldwin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Bitsqueezer

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER
developingprogrammer

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! = )
Gustav Brock

You are wrong about that. A constant is - eh - constant.

/gustav
ASKER
developingprogrammer

Oops you are right gustav!! Silly me!! Haha = )) thanks for clearing up my head!! = ))
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23