我的if有用错了吗,实现不到十进制转八进制的转换
Private Sub Command1_Click()
Dim a As Integer
Text2.Text = ""
a = Val(Text1.Text)
If Combo1.Text = "十进制转换二进制" Then
Do
Text2.Text = Trim(Str(a Mod 2)) + Text2.Text
a = Int(a / 2)
Loop Until a = 0
ElseIf Combo1.Text = "十进制转换八进制" Then
Do
Text2.Text = Oct(Trim(Str(a Mod 8))) + Text2.Text
a = Int(a / 8)
Loop Until a = 0
Else
Do
Text2.Text = Hex(Trim(Str(a Mod 16))) + Text2.Text
a = Int(a / 16)
Loop Until a = 0
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
With Combo1
.AddItem "十进制转换二进制"
.AddItem "十进制转换八进制"
.AddItem "十进制转换十六进制"
End With
End Sub