-
I'm trying to convert a hex value to a decimal value
I'm really stuck here.
My programs has to go into the header of a dbf file and reverse 4 digists
ex.
00 00 06 99
99 06 00 00
New values is 996 is the new hex value
Now I need to convert it to decimal value.
Any clues?
I used the computer calculator and it works fine so there has to be a way.
Bruno
-
HexString->LongValue
Code:
Dim strHex As String
Dim lngVal as Long
strHex = "D00D"
lngVal = CLng("&H" & strHex)
there ya go, easy enough? :)
-
...
beat me 2 it
or i = CInt("&h" & s)
-
Try This:
Code:
MYHEX$ = "7FFFFFFF"
Mydec& = Val("&H" & MYHEX$)
NOTE: This was a example I saw on Planet Source Code!
-
FYI... Val() is ok to use but, remember it returns a Double. So it has to cast to a byte/integer/long etc. which results in a small performance hit. ;)
-
Also, keep in mind that Val() is usually used to convert strings to numbers. When you want to convert numbers, use CDbl().