Hi All,
I am hoping you can help me understand what I am missing or have incorrect in the below code. This is a simple loan calculator that in turn should display amortization schedule through the ListView. however, I am getting "some" data to return but it isn't correct. Can you please help me understand this as I have this as a project that I have to turn in this week. Any help will be greatly appreciated :-)
Also, as shown below in the screenshot, it displays some of the data, but incorrectly.
ATTACH]113115[/ATTACH]Code:Dim Num, n1 As Integer Dim I, P, PVIFA, r, lnpmt, PI, PP As Double Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click P = txtLoanAmount.Text Num = txtMonths.Text r = txtInterestRate.Text I = r / 100 PVIFA = 1 / I - 1 / (I * (1 + I) ^ Num) lnpmt = P / PVIFA lblTotal.Text = Math.Round(lnpmt, 2) End Sub Private Sub btnAmortize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAmortize.Click Do n1 = n1 + 1 PI = P * I PP = lnpmt - PI P = P - PP ListView1.Items.Add(n1.ToString()) ListView1.Items.Add(PP.ToString("$,####.00")) ListView1.Items.Add(PI.ToString("C")) ListView1.Items.Add(P.ToString("$,####.00")) ListView1.Items.Add(lnpmt.ToString("$,####.00")) If P = 0 Then End If Exit Do Loop End Sub




Reply With Quote
