Hex->Decimal
Author Message
Hex->Decimal

Hi all, any ideas what the most efficient way to convert hex->decimal is? I
wrote a routine that used a really shady technique that was about 30 lines
long and I forgot to save it, doh. Now I'm looking for a way to do it
without retyping all that junk. So... any ideas?

Sun, 14 Oct 2001 03:00:00 GMT
Hex->Decimal
Use the Hex() function.  It's 1 line long.
Quote:

> Hi all, any ideas what the most efficient way to convert hex->decimal is? I
> wrote a routine that used a really shady technique that was about 30 lines
> long and I forgot to save it, doh. Now I'm looking for a way to do it
> without retyping all that junk. So... any ideas?

Sun, 14 Oct 2001 03:00:00 GMT
Hex->Decimal

Quote:

>Hi all, any ideas what the most efficient way to convert hex->decimal is? I
>wrote a routine that used a really shady technique that was about 30 lines
>long and I forgot to save it, doh. Now I'm looking for a way to do it
>without retyping all that junk. So... any ideas?

Dim lValue As Long
lValue = CLng("&H" & sHexString)

Lee Weiner
weiner AT fuse DOT net
http://home.fuse.net/lweiner

Sun, 14 Oct 2001 03:00:00 GMT
Hex->Decimal
Just using Hex() will give you Decimal -> Hex, to go the other way you could
use something like this:

CInt("&H" & Hex(x))    ...  or maybe use CLng depending on what you need.

Probably the best way to do it in VB..

- Erik Schaible
Centre Analytical Laboratories

Quote:

>Use the Hex() function.  It's 1 line long.

>> Hi all, any ideas what the most efficient way to convert hex->decimal is?
I
>> wrote a routine that used a really shady technique that was about 30
lines
>> long and I forgot to save it, doh. Now I'm looking for a way to do it
>> without retyping all that junk. So... any ideas?

Sun, 14 Oct 2001 03:00:00 GMT
Hex->Decimal
You dancer, thanks for the help guys, the

lValue = CLng("&H" & sHexString)

works, I'm glad I asked here before I tried rewriting my messy code.

Thanks again.