Private Sub Command1_Click()
n1 = CInt(Text1)
For i = 1 To Len(Text2)
c = Mid(Text2, i, 1)
If c >= "0" And c <= "9" Then
If c < Chr(48 + n1) Then
s = s * n1 + Asc(c) - 48
Else
MsgBox ("输入的数据有误!")
Text2 = ""
Exit Sub
End If
Else
If c >= "a" And c <= "f" Then c = Chr(Asc(c) - 32)
If c < "A" Or c > "F" Then
MsgBox ("输入的数据有误!")
Text2 = ""
Exit Sub
End If
End If
Next i
n2 = CInt(Text3)
s1 = ""
While s > 0
c = s Mod n2
If c <= 9 Then
s1 = c & s1
Else
s1 = Chr(55 + c) & s1
End If
s = s \ n2
Wend
Text4 = s1
End Sub
Private Sub Form_Load()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
End Sub