Solved

data type conversion

Posted on 1998-10-05
2
159 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 150 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

776 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