是让表现每月的还款金额
Private Sub btncalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalculate.Click
Dim PVal, APR, Payment, TotPmts As Double
Dim PayType As DueDate
Dim Fmt As String = "###,###,##0.00"
Dim FVal As Double = 0
PVal = CDbl(txtloan.Text)
If cmbpayment.SelectedIndex = 0 Then
APR = 0.3
ElseIf cmbpayment.SelectedIndex = 1 Then
APR = 0.4
ElseIf cmbpayment.SelectedIndex = 2 Then
APR = 0.5
ElseIf cmbpayment.SelectedIndex = 3 Then
APR = 0.6
End If
If APR > 1 Then APR = APR / 100
TotPmts = CDbl(year * 12)
Payment = Pmt(APR / 12, TotPmts, -PVal, FVal, PayType)
Dim i As Integer = 0
Dim rowscolums As String = "{0,-10}{1,13}{2,27}{3,38}"
lstloan.Items.Add(String.Format(rowscolums, "Month", "Amount", "Accumulated", "Balance"))
Do
lstloan.Items.Add(String.Format(rowscolums, i + 1, Math.Round(Payment, 2), Math.Round(Payment * (i + 1), 2), Math.Round((PVal - Payment), 2)))
i += 1
PVal -= Payment
Loop Until i >= TotPmts
End Sub
Private Sub btncalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalculate.Click
Dim PVal, APR, Payment, TotPmts As Double
Dim PayType As DueDate
Dim Fmt As String = "###,###,##0.00"
Dim FVal As Double = 0
PVal = CDbl(txtloan.Text)
If cmbpayment.SelectedIndex = 0 Then
APR = 0.3
ElseIf cmbpayment.SelectedIndex = 1 Then
APR = 0.4
ElseIf cmbpayment.SelectedIndex = 2 Then
APR = 0.5
ElseIf cmbpayment.SelectedIndex = 3 Then
APR = 0.6
End If
If APR > 1 Then APR = APR / 100
TotPmts = CDbl(year * 12)
Payment = Pmt(APR / 12, TotPmts, -PVal, FVal, PayType)
Dim i As Integer = 0
Dim rowscolums As String = "{0,-10}{1,13}{2,27}{3,38}"
lstloan.Items.Add(String.Format(rowscolums, "Month", "Amount", "Accumulated", "Balance"))
Do
lstloan.Items.Add(String.Format(rowscolums, i + 1, Math.Round(Payment, 2), Math.Round(Payment * (i + 1), 2), Math.Round((PVal - Payment), 2)))
i += 1
PVal -= Payment
Loop Until i >= TotPmts
End Sub