parseInt function in VB6 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

parseInt function in VB6

Hi, I am looking for something similar to javascript's parseInt() function in Visual Basic. The code would translate the hexadecimal value of a string into a integer. the javascript code looks like this:

parseInt("0x" + String_Val)

The "Ox" added tells javascript to use hexadecimal format.

example: String_Val of 98 would return 152
String_Val of B3 would return 179

Thanx for any help.

Comments

  • MalcolmMalcolm Posts: 828Member
    : Hi, I am looking for something similar to javascript's parseInt() function in Visual Basic. The code would translate the hexadecimal value of a string into a integer. the javascript code looks like this:
    :
    : parseInt("0x" + String_Val)
    :
    : The "Ox" added tells javascript to use hexadecimal format.
    :
    : example: String_Val of 98 would return 152
    : String_Val of B3 would return 179
    :
    : Thanx for any help.
    :

    I can't get it to return those values, but I thought you could convert Hex To an Integer using one or both of the Val or CInt functions. It could be that I was passing the Hexadecimal Value Wrong.



  • KDivad LeahcimKDivad Leahcim Posts: 3,948Member
    : : Hi, I am looking for something similar to javascript's parseInt() function in Visual Basic. The code would translate the hexadecimal value of a string into a integer. the javascript code looks like this:
    : :
    : : parseInt("0x" + String_Val)
    : :
    : : The "Ox" added tells javascript to use hexadecimal format.
    : :
    : : example: String_Val of 98 would return 152
    : : String_Val of B3 would return 179
    : :
    : : Thanx for any help.
    : :
    :
    : I can't get it to return those values, but I thought you could convert Hex To an Integer using one or both of the Val or CInt functions. It could be that I was passing the Hexadecimal Value Wrong.
    :

    Val("&H" & String_Val)
    Val("&H" & "98") '152
    Val("&H" & "B3") '179

    &O can be used for octal numbers...
  • WizCrack42WizCrack42 Posts: 3Member
    : : : Hi, I am looking for something similar to javascript's parseInt() function in Visual Basic. The code would translate the hexadecimal value of a string into a integer. the javascript code looks like this:
    : : :
    : : : parseInt("0x" + String_Val)
    : : :
    : : : The "Ox" added tells javascript to use hexadecimal format.
    : : :
    : : : example: String_Val of 98 would return 152
    : : : String_Val of B3 would return 179
    : : :
    : : : Thanx for any help.
    : : :
    : :
    : : I can't get it to return those values, but I thought you could convert Hex To an Integer using one or both of the Val or CInt functions. It could be that I was passing the Hexadecimal Value Wrong.
    : :
    :
    : Val("&H" & String_Val)
    : Val("&H" & "98") '152
    : Val("&H" & "B3") '179
    :
    : &O can be used for octal numbers...
    :
    Thanks, worked perfectly.
Sign In or Register to comment.