Solved

data type conversion

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now