计算器1.rar (10 K) 下载次数:13 这是我学着编的第一个作品,请大家给点评价:
学习中献丑了!
源代码如下: Private Sub Command1_Click()
Dim a, b, result As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
If Option1 = True Then
result = a + b
End If
If Option2 = True Then
result = a - b
End If
If Option3 = True Then
result = a * b
End If
If Option4 = True Then
If Text2 = 0 Then
MsgBox "除数不能为0"
Else
result = a / b
End If
End If
Text3 = result
End Sub
Private Sub Option1_Click()
optiot1 = "+"
Text3 = ""
End Sub
Private Sub Option2_Click()
optint2 = "-"
Text3 = ""
End Sub
Private Sub Option3_Click()
optint3 = "*"
Text3 = ""
End Sub
Private Sub Option4_Click()
optiot4 = "/"
Text3 = ""
End Sub
[ 此贴被我心飞翔在2008-03-30 10:28重新编辑 ]