One of your TextBox
items has not been filled in.
As such, when you use CDbl
, such as P = CDbl(txtAmount.Text)
, if the TextBox
is empty, it will cause this error.
A better option would be to use Double.TryParse instead of CDbl
, as it will allow you to raise a proper message:
Private Sub btnAnalyze_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnalyze.Click
If Not Double.TryParse(txtAmount.Text, P) Then
MessageBox.Show("Please correct the loan amount")
Exit Sub
End If
' Do the same for all other CDbl checks
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…