1、Private Sub Command1_Click() Dim s As String, i As Integer, t As String, sum As Integer, j As Integer s = Text1 If Len(s) Mod 3 0 Then s = String(3 - Len(s) Mod 3, 0) & s For i = 1 To Len(s) Step 3 t = Mid(s, i, 3) sum = 0 For j = 1 To Len(t) 二进制到八进制 sum = sum + Mid(t, j, 1) * 2 (Len(t) - j) Next j
2、Text2 = Text2 & sum Next iEnd SubPrivate Sub Command2_Click() Dim s As String, i As Integer, t As String, sum As Integer, j As Integer s = Text3 If Len(s) Mod 4 0 Then s = String(4 - Len(s) Mod 4, 0) & s For i = 1 To Len(s) Step 4 t = Mid(s, i, 4) sum = 0 For j = 1 To Len(t) 二进制到十进制 sum = sum + Mid(
3、t, j, 1) * 2 (Len(t) - j) Next j Text4 = Text4 & sum Next iEnd SubPrivate Sub Command3_Click() Dim s As String, i As Integer, t As String, sum As Integer, j As Integer, s1 As String s = Text5 If Len(s) Mod 4 0 Then s = String(4 - Len(s) Mod 4, 0) & s For i = 1 To Len(s) Step 4 t = Mid(s, i, 4) sum = 0 二进制到十六进制 For j = 1 To Len(t) sum = sum + Mid(t, j, 1) * 2 (Len(t) - j) Next j If sum 9 Then s1 = Chr(sum + 55) Else s1 = sum Text6 = Text6 & s1 Next iEnd Sub