Convert hex value to decimal value in VB6

How to convert hex value to decimal value in VB6?

I am trying to see if this works:

Dim hexVal as string hexVal = "#7B19AB" clng("&H" & hexVal) 

However, I get the error < MisMatch type .

+6
source share
7 answers

Get rid of the sign #

 Dim hexVal as string hexVal = "7B19AB" clng("&H" & hexVal) 
+9
source

Get rid of the number sign (#) in the string hexVal.

+4
source

It should do it

 Dim hexVal as String hexVal = "#7B19AB" Dim intVal as Integer intVal = Val("&H" & Replace(hexVal, "#", "")) 
+1
source

Try:

 value=CDbl("&H" & HexValue) 

or

 value=CInt("&H" & HexValue) 'but range +- 32,768 
+1
source

Try it like this:

 Print Hex(Asc(Text1.Text)) 
+1
source
 Dim uzunluk as Integer On Error Resume Next uzunluk = Len(Text1.Text) For i = 0 To uzunluk Text1.SelStart = i Text1.SelLength = 1 Print Hex(Asc(Text1.SelText)) Next i 
0
source
 Dim hexVal As String Dim str As String Dim uzunluk As Integer On Error Resume Next hexVal = "#7B19AB" str = Replace(hexVal, "#", "") Text1.Text = str uzunluk = Len(Text1.Text) For i = 0 To uzunluk Text1.SelStart = i Text1.SelLength = 1 Print Hex(Asc(Text1.SelText)) Next i 
0
source

Source: https://habr.com/ru/post/891853/


All Articles