Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

data type conversion

Posted on 1998-10-05
2
Medium Priority
?
174 Views
Last Modified: 2010-04-30
how to convert a string of ascii hexadecimal values into unsigned long integer in Visual Basic?
0
Comment
Question by:purushotham
2 Comments
 
LVL 9

Expert Comment

by:Dalin
ID: 1438171
purushotham,
You should be able to get it with the combination of cLng, Chr, and ASC function.
Regards
Dalin
0
 
LVL 2

Accepted Solution

by:
swilt earned 300 total points
ID: 1438172
This should give the right answers

Public Function ConvHex2Dec(ByVal sInp As String) As Long
    Dim nRet As Long
   
    If Len(sInp) > 8 Then
        MsgBox "Too long"
    Else
        nRet = Val("&H" & sInp)
        If nRet < 0 And Len(sInp) < 8 Then
            While Len(sInp) < 7
                sInp = "0" & sInp
            Wend
            nRet = Val("&H8" & sInp) And &H7FFFFFFF
        End If
    End If
   
    ConvHex2Dec = nRet
End Function
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

927 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