我正在为我的学校项目编写一些计算应用程序,我正在使用的代码是
Private Sub C1A_Leave(sender As Object, e As EventArgs) Handles C1A.Leave
If C1A.Text = "" Then
Else
C2A.Text = Double.Parse(C1A.Text) * Double.Parse(C1ER.Text)
If SellMove.Checked = True Then
C1NC.Text = Double.Parse(C1OC.Text) - Double.Parse(C1A.Text)
C2NC.Text = Double.Parse(C2OC.Text) + Double.Parse(C2A.Text)
ElseIf BuyMove.Checked = True Then
C1NC.Text = Double.Parse(C1OC.Text) + Double.Parse(C1A.Text)
C2NC.Text = Double.Parse(C2OC.Text) - Double.Parse(C2A.Text)
End If
C2A.Text = CDec(C2A.Text).ToString("N")
C1A.Text = CDec(C1A.Text).ToString("N")
C1NC.Text = CDec(C1NC.Text).ToString("N")
C2NC.Text = CDec(C2NC.Text).ToString("N")
End If
End Sub
但是我收到了mscorlib.dll VB.net中发生的'System.FormatException'类型的未处理异常的错误
问题是,当C1OC和C2OC文本= 0时,它可以工作,但是如果它不为0,则向我显示错误。
请帮助