我要一个简单的计算器 在text1.text和text2.text 2个框内输入2个数
然后有加减乘除四个单选按钮,要求选中其中一个按钮后,按command1按钮
在text3.text中显示出计算结果 我编写的代码如下,主要是不知道怎么把运算和单选按钮合在一起用
Private Sub Form_Load()
Dim a%, b%, c%
a = Val(Text1.Text)
b = Val(Text2.Text)
End Sub
Private Sub Check1_Click()
If Check1.Value = 1 Then
Text3.FontItalic = True
Else
Text3.FontItalic = False
End If
End SubPrivate Sub Check2_Click()
If Check2.Value = 1 Then
Text3.FontBold = True
Else
Text3.FontBold = False
End If
End SubPrivate Sub Command1_Click()
If Option1.Value = True Then
Text3.Text = a + b
ElseIf Option2.Value = True Then
Text3.Text = a - b
ElseIf Option3.Value = True Then
Text3.Text = a * b
ElseIf Option4.Value = True Then
Text3.Text = a / b
End If
End SubPrivate Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End SubPrivate Sub Command3_Click()
End
End Sub