# Hex

• 18 years ago

I think this is something to do with hex but i thought that hex was a 2 character thing not 3 (the h on the end means hex).

I have listed a few of some hex values i think they are some sorta hex
H - 048h
e - 065h
o - 06fh
l - 06ch
- 020h

I am trying to find out what is the equation from ascii code to hex and back or can someone give me a big listing of all the values/characters that could be used.

Thanks

• 18 years ago

if u use vb u can use the "hex()" function to hex the values, to go from hex back to ansi then use the same function but prefix the values with "&h" which should give u what u want.

• 18 years ago

thanks for that there are heaps of them little functions built into vb

• 18 years ago

hexadecimal is base16, whereas 'decimal' is base10...
so to convert between the two, just switch bases...

i.e., one way (longer way) is to do this:

Hex #'s go from 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
A-F = 10 - 15
So if you have a number like:

08CA, then it is
016^3+816^2+1216^1+1016^0

To convert a decimal number from decimal to hex,
you divide by the largest power,and then carry over
the remainder with smaller powers.

I.e., so 2250/256= 8 + 202 as a remainder
202/16=12 + 10 as a remainder
10/1 (16^0) = 10 + 0 as a remainder...

so you now have 8,12,10... you now convert to
the hex numbering system, and you have "8CA"...!

• 18 years ago

thanks but i think that is what the vb function does, so i will keep with that, but thanks for explaing how it is converted

### Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

### Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.”