VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Convert Hex value to decimal equilivant. Great for color functions.

by Dev Oasis (1 Submission)
Category: Math/Dates
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Tue 3rd December 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Convert Hex value to decimal equilivant. Great for color functions.

Rate Convert Hex value to decimal equilivant. Great for color functions.



    Dim LC As Long
    Dim curHexValue As String
    Dim curChar As String
    Dim curValue As String
    
    curHexValue = UCase(Trim(paraHexValue))
    If Left(curHexValue, 2) = "&H" Then curHexValue = Mid(curHexValue, 3)
    For LC = 1 To Len(curHexValue)
        curChar = Mid(curHexValue, LC, 1)
        If InStr(1, "ABCDEF", curChar) <> 0 Then curChar = Asc(curChar) - 55
        curValue = Val(curValue) + (Val(curChar) * (16 ^ (Len(curHexValue) - LC)))
    Next LC
    Hex2Dec = Val(curValue)
End Function

Download this snippet    Add to My Saved Code

Convert Hex value to decimal equilivant. Great for color functions. Comments

No comments have been posted about Convert Hex value to decimal equilivant. Great for color functions.. Why not be the first to post a comment about Convert Hex value to decimal equilivant. Great for color functions..

Post your comment

Subject:
Message:
0/1000 characters