VB中将十六进制转化为十进制,代码怎么写啊?

2024-12-15 03:27:16
推荐回答(1个)
回答1:

Dim s as string = "FF" --16进制作为字符串
Dim value as Integer
value = val( "&h" & s ) --10进制整型
---
或用 System.Convert.ToInt32(string, integer)
Dim i As Integer
i = Convert.ToInt32("abcd", 16)

---
Dim s As String = "0A"
MsgBox(CInt("&H" & s))
MsgBox(Convert.ToInt32(s, 16))