Solved

Visual Basic CLng() return problem

Posted on 2004-04-19
11
1,513 Views
Last Modified: 2007-12-19
I am trying to run CLng() to convert decimal to hex inside one of my functions.  The problem is when clng runs in my function it bumps out of the function.  It will not return to the next line in my function.  Any ideas or better ways to convert dec to hex?
0
Comment
Question by:bluedragon99
11 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10865138
you can use Hex() function.
0
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10865148
0
 
LVL 1

Author Comment

by:bluedragon99
ID: 10865163
Sorry I need Hex to To decimal, had them backwards.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 8

Expert Comment

by:rajaloysious
ID: 10865307
Use the VAL function and i hope that is it all it takes to solve your problem
Good Luck
0
 
LVL 8

Expert Comment

by:harris_c
ID: 10866528
0
 
LVL 1

Expert Comment

by:vware
ID: 10866804
try
Debug.Print Val("&H" & CStr(DecimalValue))
0
 
LVL 5

Expert Comment

by:avya2k
ID: 10867548
what is the error and at which code segment
0
 
LVL 2

Expert Comment

by:Ivan_Skrinjaric
ID: 10867622
If you wont long try clng("&H" & cstr(number))
0
 
LVL 3

Accepted Solution

by:
elantra earned 500 total points
ID: 10872824
Here is a function that will convert Hex -> Dec.  Just pass the function your hex value.  Example:  

MsgBox HexToDec(InputBox("Enter a HEX value:"))

---------------------------------------------------------------------------------------------------

Function HexToDec(HexNumber)
    HexToDec = CLng("&H" & HexNumber)
End Function
0
 
LVL 1

Author Comment

by:bluedragon99
ID: 10894351
very nice!
0
 
LVL 1

Author Comment

by:bluedragon99
ID: 10894357
function in a function hehe
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question