哪位高手帮我看看下面的程序有什么不对!!

来源:百度知道 编辑:UC知道 时间:2024/05/31 16:30:06
是一个关于任意输入数据和操作符进行运算的程序Private Sub Command1_Click()
Select Case (Trim(Text3.Text))
Case "+"
Text4.Text = Val(Text1.Text) + Val(Text2.Text)
Case "-"
Text4.Text = Val(Text1.Text) - Val(Text2.Text)
Case "*"
Text4.Text = Val(Text1.Text) * Val(Text2.Text)
Case "/"
If Val(Text2.Text) = 0 Then
MsgBox "除数不能为0!"
Exit Sub
Text4.Text = Val(Text1.Text) / Val(Text2.Text)
Case Else
MsgBox "运算有误,请检查!!"
End Select

End Sub
为什么老是提示Case Else在select case外!!怎么修改啊???

Private Sub Command1_Click()
Select Case (Trim(Text3.Text))
Case "+"
Text4.Text = Val(Text1.Text) + Val(Text2.Text)
Case "-"
Text4.Text = Val(Text1.Text) - Val(Text2.Text)
Case "*"
Text4.Text = Val(Text1.Text) * Val(Text2.Text)
Case "/"
If Val(Text2.Text) = 0 Then
MsgBox "除数不能为0!"
Exit Sub
End if '是不是要这样啊。
Text4.Text = Val(Text1.Text) / Val(Text2.Text)
Case Else
MsgBox "运算有误,请检查!!"
End Select

End Sub