?
Solved

Visual Basic CLng() return problem

Posted on 2004-04-19
11
Medium Priority
?
1,540 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 12

Expert Comment

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

Author Comment

by:bluedragon99
ID: 10865163
Sorry I need Hex to To decimal, had them backwards.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 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 2000 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Simple Linear Regression
Suggested Courses

777 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