Click to See Complete Forum and Search --> : How can I plus two hex number?
kevin shen
May 8th, 2001, 08:03 PM
How can I plus two hex number?
Dim a, b, c as string
b = Hex(11)
c = Hex(12)
a = b + c
it's not working. a is just add two b and c string together.
Thanks!
Best Regards,
Kevin Shen
cksiow
May 8th, 2001, 08:30 PM
you need a function to convet hex back to decimal, refer http://vblib.virtualave.net, there is a function called HexStr2Dec in vbStrings class.
public vbStrings as new vbStrings
Dim a, b, c as string
dim d, e as byte
b = Hex(11)
c = Hex(12)
d = vbStrings.HexStr2Dec(b)
e = vbStrings.HexStr2Dec(c)
a = Hex(d + e)
HTH
kevin shen
May 8th, 2001, 09:20 PM
I have to convert hex back to decimal, then add them together? Do you know how I could add the two hex directly?
Thanks!
Best Regards,
Kevin Shen
cksiow
May 8th, 2001, 09:41 PM
try this
Dim a, b, c as string
b = Hex(11)
c = Hex(12)
e = Hex(val("&h" & b) + val("&h" & c))
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.