Finding the number value of a hex value 
Author Message
 Finding the number value of a hex value

The Hex value of 76 is 4C. I would normally determine this by:
x = Hex(76)
Now. How would I go about finding out the value of x. I want to know the
correct syntax to get a variable to come out to be 76. I know you're supposed
to use &H to find out the value of a hex value. But you can't use variables
with that. Like &HX. It returns a type mismatch error. I hope I made myself
clear.

Alvin Cartuyvels
Internet Manager
Printer's Repair Parts
http://www.*-*-*.com/



Sun, 20 Jan 2002 03:00:00 GMT  
 Finding the number value of a hex value
Alvin,
I think that you are making this more difficult than it is.  Consider:
  x = &H4C
 print x
 (prints 76)
HTH,
Armstead Feland
Quote:

> The Hex value of 76 is 4C. I would normally determine this by:
> x = Hex(76)
> Now. How would I go about finding out the value of x. I want to know the
> correct syntax to get a variable to come out to be 76. I know you're supposed
> to use &H to find out the value of a hex value. But you can't use variables
> with that. Like &HX. It returns a type mismatch error. I hope I made myself
> clear.

> Alvin Cartuyvels
> Internet Manager
> Printer's Repair Parts
> http://www.printersrepairparts.com




Sun, 20 Jan 2002 03:00:00 GMT  
 Finding the number value of a hex value
Alvin,

Here is some code that may do what you need:

Private Sub Command1_Click()

    Dim myHex As String, myDecimal As Long

    myHex = Hex(76)
    MsgBox "Hex = " & myHex

    myDecimal = "&H" & myHex
    MsgBox "Decimal = " & myDecimal

End Sub

Hope this helps,

Kerry Moorman

Quote:

>The Hex value of 76 is 4C. I would normally determine this by:
>x = Hex(76)
>Now. How would I go about finding out the value of x. I want to know the
>correct syntax to get a variable to come out to be 76. I know you're
supposed
>to use &H to find out the value of a hex value. But you can't use variables
>with that. Like &HX. It returns a type mismatch error. I hope I made myself
>clear.

>Alvin Cartuyvels
>Internet Manager
>Printer's Repair Parts
>http://www.printersrepairparts.com




Sun, 20 Jan 2002 03:00:00 GMT  
 Finding the number value of a hex value
x = Hex(76)
y = Val("&H" & x)

Mike


Quote:
> The Hex value of 76 is 4C. I would normally determine this by:
> x = Hex(76)
> Now. How would I go about finding out the value of x. I want to know the
> correct syntax to get a variable to come out to be 76. I know you're
supposed
> to use &H to find out the value of a hex value. But you can't use
variables
> with that. Like &HX. It returns a type mismatch error. I hope I made
myself
> clear.

> Alvin Cartuyvels
> Internet Manager
> Printer's Repair Parts
> http://www.printersrepairparts.com




Sun, 20 Jan 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Converting hex value in str format to hex

2. unescape (or convert) to hex value Attachments

3. Hex values in VB...

4. Allowing only Hex values...

5. RegWrite with long hex values

6. RGB with hex values fails on Windows2000

7. Help me convert system color NAMES to hex or RGB VALUES

8. Hex to ASCII values?

9. Bits and hex values

10. HEX values for colors in VB

11. Registry Hex Values

12. Displaying hex values in Access97

 

 
Powered by phpBB® Forum Software