Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b, d As Single
Dim c As Char
a = Val(TextBox1.Text)
b = Val(TextBox3.Text)
c = Trim(TextBox2.Text)
If c = "+" Then
d = a + b
ElseIf c = "-" Then
d = a - b
ElseIf c = "*" Then
d = a * b
ElseIf c = "/" Then
If b = 0 Then
MsgBox("分母为0", "sy3 - 6")
exit sub
End If
d = a / b
End If
TextBox4.Text = d
End Sub
"+"c
四个全部加c
Dim c As Char 改成 Dim c As String