你的应该是输入十进制吧?
你懂各个进制怎么转化的方法,懂VB的语法就会觉得不难了。建设先学好VB的语法,不然你看代码有一点点困难的。
下面代码供你参考:
1.将十进制转化为二进制
Public Function DEC_to_BIN(Dec As Long) As String
DEC_to_BIN = ""
Do While Dec > 0
DEC_to_BIN = Dec Mod 2 & DEC_to_BIN
Dec = Dec \ 2
Loop
End Function
2.将十进制转化为八进制
Public Function DEC_to_OCT(Dec As Long) As String
DEC_to_OCT = ""
Do While Dec > 0
DEC_to_OCT = Dec Mod 8 & DEC_to_OCT
Dec = Dec \ 8
Loop
End Function
3.将十进制转化为十六进制
Public Function DEC_to_HEX(Dec As Long) As String
Dim a As String
DEC_to_HEX = ""
Do While Dec > 0
a = CStr(Dec Mod 16)
Select Case a
Case "10": a = "A"
Case "11": a = "B"
Case "12": a = "C"
Case "13": a = "D"
Case "14": a = "E"
Case "15": a = "F"
End Select
DEC_to_HEX = a & DEC_to_HEX
Dec = Dec \ 16
Loop
End Function
要是有代码还不知道用的话,那就好好学好VB语法吧~~~~