[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Visual Basic CLng() return problem

Posted on 2004-04-19
11
Medium Priority
?
1,563 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 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Introduction to Processes

865 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