除法没判断除数为0的情况
可以不用判断, ,net会自己判断,
但是最好还是判断下 ,这是好习惯
全国最大的 Java专业电子书免费分享[url]http:///in.asp?id=xrmao[/url]
这是你要的计算机+-*/代码:
Dim a, b As Decimal
Try
a = Convert.ToDecimal(Me.TextBox1.Text)
Catch
Me.TextBox3.Text = "error"
Exit Sub
End Try
Try
b = Convert.ToDecimal(Me.TextBox2.Text)
Catch
Me.TextBox3.Text = "error"
Exit Sub
End Try
Select Case Me.RadioButtonList1.SelectedValue
Case "+"
Me.TextBox3.Text = a + b
Case "-"
Me.TextBox3.Text = a - b
Case "*"
Me.TextBox3.Text = a * b
Case "/"
Try
Me.TextBox3.Text = a / b
Catch
Me.TextBox3.Text = "error"
End Try
End Select
你的代码里缺个判断除数=0时应该怎么办的语句!