Help?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim loanAmount As Integer = AmountBorrowedBox1.Text
'create arrays to hold interest rate and length of loan
Dim Interest() As Decimal = {5.35, 5.5, 5.75}
Dim term() As Integer = {7, 15, 30}
'establish value of radio buttons
If InterestRate1.Checked = True Then
apr = Interest(0)
End If
If InterestRate2.Checked = True Then
apr = Interest(1)
End If
If InterestRate3.Checked = True Then
apr = Interest(2)
End If
If Term1.Checked = True Then
length = term(0)
End If
If Term2.Checked = True Then
length = term(1)
End If
If Term3.Checked = True Then
length = term(2)
End If
payment = (loanAmount * Math.Pow((apr / 12) + 1, (term)) * apr / 12) / (Math.Pow(apr / 12 + 1, (term)) - 1)
'apply payment to textbox
TextBox2.Text = "$" + payment.ToString
'validate input
If IsNumeric(AmountBorrowedBox1.Text) = False Then
MsgBox("Loan amount must be numeric. Please enter a valid loan amount.", MsgBoxStyle.Exclamation)
AmountBorrowedBox1.Clear()
AmountBorrowedBox1.Focus()
End If
End Sub

New Topic/Question
Reply




MultiQuote




|