如题所述
第1个回答 2020-04-28
Dim
opt
As
String
Private
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
Text3.Text
=
result
End
Sub
要做成上面的那个要花很多时间,所以只做了个自己输入数字的计算器。希望符合。
opt
As
String
Private
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
Text3.Text
=
result
End
Sub
要做成上面的那个要花很多时间,所以只做了个自己输入数字的计算器。希望符合。