VB 16进制转10进制 如何编写?
答案:1 悬赏:0 手机版
解决时间 2021-04-27 04:14
- 提问者网友:遮云壑
- 2021-04-26 06:32
VB 16进制转10进制 如何编写?
最佳答案
- 五星知识达人网友:七十二街
- 2021-04-26 06:45
Private Sub Command1_Click()
Text2.Text = ""
ST Text1.Text
End Sub
Private Sub ST(strz As String)
Dim s As Integer, a As Integer, i As Integer, strg As String 'strz是你输入的16进制数
For i = Len(strz) To 1 Step -1
strg = Mid(strz, i, 1)
If Asc(strg) >= 65 And Asc(strg) <= 70 Then
a = Asc(strg) - 55
ElseIf Asc(strg) >= 97 Then
a = Asc(strg) - 87
Else
a = strg
End If
s = s + a * 16 ^ (i - 1)
Next i
Text2 = Text2 & s
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii < 65 Or KeyAscii > 70) And (KeyAscii < 97 Or KeyAscii > 102) And (KeyAscii < 48 Or KeyAscii > 57) Then
i = MsgBox("请输入16进制数")
End If
End Sub
Text2.Text = ""
ST Text1.Text
End Sub
Private Sub ST(strz As String)
Dim s As Integer, a As Integer, i As Integer, strg As String 'strz是你输入的16进制数
For i = Len(strz) To 1 Step -1
strg = Mid(strz, i, 1)
If Asc(strg) >= 65 And Asc(strg) <= 70 Then
a = Asc(strg) - 55
ElseIf Asc(strg) >= 97 Then
a = Asc(strg) - 87
Else
a = strg
End If
s = s + a * 16 ^ (i - 1)
Next i
Text2 = Text2 & s
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii < 65 Or KeyAscii > 70) And (KeyAscii < 97 Or KeyAscii > 102) And (KeyAscii < 48 Or KeyAscii > 57) Then
i = MsgBox("请输入16进制数")
End If
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯