0

I'm having problems with if statements

present value (PV) should be no larger than $10000

interest rate is not higher than 10 and no less than 2

and number of years at least 3

I've tried the if statements with error messageboxs but I was getting confused with all the if's and the messagebox didn't show up right. The following code is my code before entering the if's. Any insight would be very helpful, thank you.

```
Public Class Form1
Public Function FV(ByVal PV As Object, ByVal i As Object, ByVal n As Object) As Object
'Formula to calculate Future Value(FV)
'PV denotes Present Value
FV = PV * (1 + i / 100) ^ n
End Function
Private Sub compute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles compute.Click
'This procedure will calculate Future Value
Dim FutureVal As Decimal
Dim PresentVal As Decimal
Dim interest As Object
Dim period As Object
PresentVal = PV.Text
interest = rate.Text
period = years.Text
FutureVal = FV(PresentVal, interest, period)
lblFV.Text = FormatCurrency(FutureVal)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
End Class
```