-
Aug 23rd, 2000, 10:55 PM
#1
Thread Starter
Lively Member
Hi Guys,
I need to know how to convert Hexidecimal into decimal in Vb6.0
I am receiving data from my comm port in Text and there are some values that are in Hex. but i need the numeric value of them.
is that a command of module that i can use to do this?
let me know.
Thanks in advance.
EL.
-
Aug 24th, 2000, 06:33 AM
#2
Frenzied Member
I don't think VB has a built-in hex to dec function
Here's one I just knocked-up:
Code:
Public Function HextoDec(HexNum As String) As Long
Dim lngOut As Long
Dim i As Integer
Dim c As Integer
For i = 1 To Len(HexNum)
c = Asc(UCase(Mid(HexNum, i, 1)))
Select Case c
Case 65 To 70
lngOut = lngOut + ((c - 55) * 16 ^ (Len(HexNum) - i))
Case 48 To 57
lngOut = lngOut + ((c - 48) * 16 ^ (Len(HexNum) - i))
Case Else
End Select
Next i
HextoDec = lngOut
End Function
-
May 6th, 2012, 03:18 PM
#3
New Member
Re: How To convert Hex to Dec in VB6.0?
More simple:
DecNumber& = CLng("&H" & HexNum$)
-
May 6th, 2012, 05:45 PM
#4
Re: How To convert Hex to Dec in VB6.0?
Wow - and this thread is over 10 years old.
Do you really want to start with threads this old
-
May 6th, 2012, 06:40 PM
#5
New Member
Re: How To convert Hex to Dec in VB6.0?
Originally Posted by szlamany
Wow - and this thread is over 10 years old.
Do you really want to start with threads this old
Because I search for this code and lost time, the two threads I answer are old but first in the search of google for this conversion, and for other people not lost time, the last instruction is the best, I test various, and this is simple, fast and totally operative...
Is the reason, for people that search this conversion, have fast and simple and good solution...
Sorry for my bad English...
Pd: Many persons use VB6, is old, but very usseful, I for example have a program in virtual machine - in a oracle sun virtualbox portable - that I sell, and in the virtual machine have a Windows XP 32 bits, and for this operative system, vb6 is fast and a good solution... And in the virtual machine my program run without changes, worked for decades is possible, and I not lost time in the changes of different versions of windows and changes and craps of microsoft...
Also in virtualbox machine is possible for my sell the program for mac and for linux, good solution without need to create 3 programs... One for each system...
One of the big problems of the programation is that is impossible arrive to a be master master master because each little time, changes, changes, changes, and the programmer need to create a good software of any thing, not lost your time in known new codes all the time...
I with the solution of virtualbox portable, is possible for me put all my time in make a better program, not lose all my time in known the stupids and always changes of microsoft...
Last edited by Javier Reinoso; May 6th, 2012 at 06:45 PM.
-
Nov 16th, 2012, 05:39 PM
#6
New Member
Re: How To convert Hex to Dec in VB6.0?
It was very useful to me. I still work a lot with VB6 and do some things the old fashioned way.
-
Sep 11th, 2017, 02:24 AM
#7
New Member
Re: How To convert Hex to Dec in VB6.0?
I enjoy your advice even today, end of 2017, CDbl("&H" & "ABCDE")
-
Sep 11th, 2017, 03:30 PM
#8
New Member
Re: How To convert Hex to Dec in VB6.0?
In fact, VB6 is not that old fashioned: it is similar to VBA in Excel, Word, and so on.
Besides, it is much easier than VB.NET.
I don't like VB6, I love it!
-
Sep 19th, 2017, 03:15 PM
#9
New Member
Re: How To convert Hex to Dec in VB6.0?
Hello
Beste Kees
my email <removed by moderator>
A.U.B my email contac
Last edited by Shaggy Hiker; Sep 19th, 2017 at 04:24 PM.
-
Sep 19th, 2017, 04:25 PM
#10
Re: How To convert Hex to Dec in VB6.0?
Do not put an email into a post. There are too many bots cruising the web ready to gather up those addresses and spam you incessantly.
My usual boring signature: Nothing
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|