我编的计算器的代码,不知道有什么问题,请大家帮忙一下。
Dim opt As StringPrivate Sub Command1_Click()
opt = "+"
End Sub
Private Sub Command2_Click()
opt = "-"
End Sub
Private Sub Command3_Click()
opt = "*"
End Sub
Private Sub Command4_Click()
opt = "/"
End Sub
Private Sub Command5_Click()
Dim a, b, result As Double
a = Text1.Text
b = Text2.Text
Select Case opt
Case "+"
result = Val(a) + Val(b)
Case "-"
result = Val(a) - Val(b)
Case "*"
result = Val(a) * Val(b)
Case "/"
result = Val(a) / Val(b)
End Select
End Sub
[ 本帖最后由 x729400643 于 2009-8-23 22:56 编辑 ]