All pastes #382449 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-05 17:27 UTC
rendered paste body
If uiRateTextBox.Text = "" Or uiPrincipalTextBox.Text = "" Then
            MessageBox.Show("Please complete the fields.")
        End If

        Dim principal As Double
        Dim interestRate As Double
        Dim loanTerm As Double
        Dim monthlyPayment As Double

        principal = Double.Parse(Me.uiPrincipalTextBox.Text)
        interestRate = Double.Parse(Me.uiRateTextBox.Text)
        loanTerm = Double.Parse(Me.uiRateTextBox.Text)

        If interestRate >= 1.0 Then
            interestRate = interestRate / 100.0
        End If

        If loanTerm >= 1.0 Then
            monthlyPayment = -Financial.Pmt(interestRate / 12, loanTerm * 12, principal, 0, DueDate.BegOfPeriod)
            Me.uiPaymentLabel.Text = monthlyPayment.ToString("C2")
        Else
            MessageBox.Show("The term must be greater than or equal to 1.", "Monthly Payment Calculator", MessageBoxButtons.OK, MessageBoxIcon.Information)