Hello guys!
I am trying to find a way to handle the argument exception errors.
I am making a small program with economic functions and I have an issue when I get the ''argument exception'' error.
This is a sample of the code:
The problem is that if I type random numbers (e.g PAYMENT>SPV or PAYMENT>0 AND SPV>0 ) I get
the argument exception problem because the output is wrong and has no economic meaning.
How can I overcome this problem? I was thinking a checking code like this:
If argument exception ..... then
messagebox .....
exit sub
End if
Is it possible something like this?
Best regards
stratos
I am trying to find a way to handle the argument exception errors.
I am making a small program with economic functions and I have an issue when I get the ''argument exception'' error.
This is a sample of the code:
Code:
Dim PAYMENT,SPV,R,PERIODS AS DOUBLE
PAYMENT = Val(TextBox1.Text) 'PAYMENT
SPV = Val(TextBox2.Text) 'PRESENT VALUE
R = Val(TextBox3.Text) 'RATE
PERIODS = NPer(R, PAYMENT, SPV, 0)
TextBox5.Text = Format(PERIODS, "STANDARD")
the argument exception problem because the output is wrong and has no economic meaning.
How can I overcome this problem? I was thinking a checking code like this:
If argument exception ..... then
messagebox .....
exit sub
End if
Is it possible something like this?
Best regards
stratos