vb编程——八进制 十进制 十六进制之间的相互转换
6个回答
展开全部
TEXT1是当前进制,text2是目标进制,text3填入数据
Private Sub Command1_Click()
MsgBox jinzhi(Text1, Text2, Text3)
End Sub
Function jinzhi(x As Long, y As Integer, z As Integer)
If x = 10 And y = 8 Then
jinzhi = Oct(z)
ElseIf x = 10 And y = 16 Then
jinzhi = Hex(z)
ElseIf x = 16 And y = 10 Then
jinzhi = Val("&H" & z)
ElseIf x = 8 And y = 10 Then
jinzhi = Val("&O" & z)
ElseIf x = 8 And y = 16 Then
jinzhi = Hex(Val("&O" & z))
ElseIf x = 16 And y = 8 Then
jinzhi = Oct(Val("&H" & z))
End If
End Function
Private Sub Command1_Click()
MsgBox jinzhi(Text1, Text2, Text3)
End Sub
Function jinzhi(x As Long, y As Integer, z As Integer)
If x = 10 And y = 8 Then
jinzhi = Oct(z)
ElseIf x = 10 And y = 16 Then
jinzhi = Hex(z)
ElseIf x = 16 And y = 10 Then
jinzhi = Val("&H" & z)
ElseIf x = 8 And y = 10 Then
jinzhi = Val("&O" & z)
ElseIf x = 8 And y = 16 Then
jinzhi = Hex(Val("&O" & z))
ElseIf x = 16 And y = 8 Then
jinzhi = Oct(Val("&H" & z))
End If
End Function
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看MSDN,有专门的函数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
多看看基础的书····
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
55555
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询