I know there are function to convert decimal to Hex and Oct, but the reverse... you have to code one or just find one on Google.<BR><BR>Try this:<BR>http://www.sonofsofaman.com/hobbies/code/hextodec.asp<BR><BR>Regards,<BR><BR>Vadim C.
I haven't tried it out... yes.. being lazy.. but this one is even shorter, to the point:<BR><BR>Function HexToDec(ByVal sHex)<BR>HexToDec = "" & CLng("&H" & sHex)<BR>End Function<BR><BR>You'll get a run-time error if the string is not hex or if the conversion produces an overflow. <BR><BR>So perhaps the first solution will be better for you... <BR><BR>Vadim C.
Function HexToDec(ByVal sHex)<BR> HexToDec = [hl="pink"]"" &[/hl] CLng("&H" & sHex)<BR>End Function<BR><BR>??? why the stuff in pink???<BR><BR>That converts the nice number you got from CLNG into a string! So that means that if you want to do any math with the result of calling that function you have to call CLNG, *again*, to convert it back from string to number.<BR><BR>Leave it as a number. If the caller *needs* it as a string, likely he/she won't need to do anything at all with it (e.g., if you Response.Write a number, it gets converted to a string automatically).<BR><BR>