Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you convert hex to decimal using VB.NET?

Tags:

.net

vb.net

I need to convert hex to a decimal in VB.NET. Found several examples in C#, but when I tried to convert to VB.NET I was not successful. An example of a hexadecimal number that I am trying to convert is "A14152464C203230304232323020572F544947455234352E".

like image 600
user38349 Avatar asked Mar 13 '09 12:03

user38349


2 Answers

Tried the others replies and this was the one that worked for me:

    Convert.ToInt32(yourHEXString, 16)

Documentation

like image 141
VGs Avatar answered Sep 24 '22 08:09

VGs


For hex values which don't actually require a bignum class to work with, you can use the normal conversion function but prefix the number with "&H". VB interprets "&H" in the text as meaning "this is a hex number", just like it does in code.

dim n = Cint("&H" & text)
like image 26
Craig Gidney Avatar answered Sep 22 '22 08:09

Craig Gidney