紧急求助,此为一个简单计算器,但是运行有问题,开方得以实现,但是+ - * / = 不知道为什么不行,请哪位高人指教下啊???
Option Explicit
Dim sz As Integer
Dim x As Single, y As Single
Private Sub Command1_Click()
Text1.Text = Text1.Text & "1"
End Sub
Private Sub Command10_Click()
Text1.Text = Text1.Text & "0"
End Sub
Private Sub Command11_Click()
Text1.Text = Text1.Text & "."
End Sub
Private Sub Command12_Click()
x = CSng(Text1.Text)
sz = 1
Text1.Text = ""
End Sub
Private Sub Command13_Click()
x = CSng(Text1.Text)
sz = 2
Text1.Text = ""
End Sub
Private Sub Command14_Click()
x = CSng(Text1.Text)
sz = 3
Text1.Text = ""
End Sub
Private Sub Command15_Click()
x = CSng(Text1.Text)
sz = 4
Text1.Text = ""
End Sub
Private Sub Command16_Click()
x = CSng(Text1.Text)
sz = 5
Text1.Text = ""
End Sub
Private Sub Command17_Click()
x = CSng(Text1.Text)
Text1.Text = Sqr(x)
End Sub
Private Sub Command18_Click()
On Error GoTo ex
y = CSng(Text1.Text)
Select Case sz
Case 1
Text1.Text = x + y
Case 2
Text1.Text = x - y
Case 3
Text1.Text = x * y
Case 4
Text1.Text = x / y
Case 5
Text1.Text = x Mod y
End Select
ex:
End Sub
Private Sub Command19_Click()
Text1.Text = ""
End Sub
Private Sub Command2_Click()
Text1.Text = Text1.Text & "2"
End Sub
Private Sub Command3_Click()
Text1.Text = Text1.Text & "3"
End Sub
Private Sub Command4_Click()
Text1.Text = Text1.Text & "4"
End Sub
Private Sub Command5_Click()
Text1.Text = Text1.Text & "5"
End Sub
Private Sub Command6_Click()
Text1.Text = Text1.Text & "6"
End Sub
Private Sub Command7_Click()
Text1.Text = Text1.Text & "7"
End Sub
Private Sub Command8_Click()
Text1.Text = Text1.Text & "8"
End Sub
Private Sub Command9_Click()
Text1.Text = Text1.Text & "9"
End Sub