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

后端 未结 9 1793
自闭症患者
自闭症患者 2020-12-11 03:04

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 th

9条回答
  •  执笔经年
    2020-12-11 03:31

    You can use the Val function in Visual Basic to convert a hexadecimal value to a decimal value. This is done by prefixing the string with "&H", to tell Visual Basic that this is a hexadecimal value, and then convert that into a number.

    Dim Value As Integer = Val("&H" & YourHexadecimalStringHere)
    

提交回复
热议问题