在窗体上画2个文本框,名称分别为TEXT1和text2;然后画2个标签,标题分别为“操作数1”“操作数2”

2024-11-20 04:33:07
推荐回答(1个)
回答1:

Private Sub Command1_Click()
For i = 0 To 3
If Option1(i).Value = True Then
opt = Option1(i).Caption
End If
Select Case opt
Case "+"
result = Val(text1.Text) + Val(text2.Text)
Case "-"
result = Val(text1.Text) - Val(text2.Text)
Case "*"
result = Val(text1.Text) * Val(text2.Text)
Case "/"
result = Val(text1.Text) / Val(text2.Text)
End Select
label4.Caption = result
End Sub