Private Sub Command1_Click()
Label1.Caption = "+"
Label2.Caption = "="
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = Str(a + b)
Text2.Visible = True
End Sub
Private Sub Command2_Click()
Label1.Caption = "-"
Label2.Caption = "="
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = Str(a - b)
Text2.Visible = True
End Sub
Private Sub Command3_Click()
Label1.Caption = "x"
Label2.Caption = "="
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = Str(a * b)
Text2.Visible = True
End Sub
Private Sub Command4_Click()
Label1.Caption = "÷"
Label2.Caption = "="
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = Str(a / b)
Text2.Visible = True
If b = 0 Then
x = MsgBox("除数不能为零", 64, "错误")
Else
Text3.Text = Str(a / b)
End If
End Sub
Private Sub Command5_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text2.Visible = True
Label1.Caption = ""
Label2.Caption = ""
End Sub
Private Sub Command6_Click()
Label1.Caption = "的"
Label2.Caption = "次方是"
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = Str(a ^ b)
Text2.Visible = True
End Sub
Private Sub Command7_Click()
Text4.Text = Text3.Text
End Sub
Private Sub Command8_Click()
Label1.Caption = ""
Label2.Caption = "开方后是"
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = Str(Sqr(a))
Text2.Visible = False
End Sub
直接输入数字,可以带上小数点了,还请大家指点