|
-
Nov 17th, 2000, 04:03 PM
#1
Thread Starter
Junior Member
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
-
Nov 17th, 2000, 04:42 PM
#2
Hyperactive Member
HexString->LongValue
Code:
Dim strHex As String
Dim lngVal as Long
strHex = "D00D"
lngVal = CLng("&H" & strHex)
there ya go, easy enough?
-
Nov 17th, 2000, 04:47 PM
#3
Fanatic Member
...
beat me 2 it
or i = CInt("&h" & s)
-
Nov 17th, 2000, 05:04 PM
#4
Addicted Member
Try This:
Code:
MYHEX$ = "7FFFFFFF"
Mydec& = Val("&H" & MYHEX$)
NOTE: This was a example I saw on Planet Source Code!
-
Nov 17th, 2000, 05:11 PM
#5
Hyperactive Member
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.
-
Nov 17th, 2000, 07:59 PM
#6
Also, keep in mind that Val() is usually used to convert strings to numbers. When you want to convert numbers, use CDbl().
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|