Help with .NET Mortgage Amortization Table?

Brandi

New member
Here is the part of the code that I am having issues with and the error message is "Error 1 'Items' is not a member of 'System.Windows.Forms.TextBox'.

Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click

' Assigning Variables and setting as Int and Double

Dim intLoanAmount As Integer
Dim intYears As Integer
Dim intTotalMonths As Integer
Dim intMonth As Integer
Dim intNumberPayments As Integer
Dim doubleInterestRate As Double
Dim doubleMonthlyInterest As Double
Dim doubleMonthlyPayment As Double
Dim doubleAdjustedInterest As Double
Dim doubleMonthlyPrinciple As Double
Dim doubleBalance As Double
Dim doubleAmortization As Double
Dim doubleTotalPrinciple As Double

' Setting values for variables
intLoanAmount = Val(LoanAmount.Text)
intYears = Val(Years.Text)
doubleInterestRate = Val(InterestRate.Text)

' Monthly mortgage payment equation
intTotalMonths = (12 * intYears)
doubleMonthlyInterest = (doubleInterestRate / 100 / 12)
doubleMonthlyPayment = (intLoanAmount * doubleMonthlyInterest) / (1 - Math.Pow(1 / (1 + doubleMonthlyInterest), intTotalMonths))

' Defines format and displays mortgage payment in Payment Label
PaymentLabel.Text = Format(doubleMonthlyPayment, "#.00")

' Amortization Calculations and schedule print out
doubleTotalPrinciple = intLoanAmount
Dim strTemp As String
Dim TextBox As String

For intYears = 1 To intYears
doubleMonthlyInterest = doubleInterestRate * doubleBalance
doubleAmortization = intLoanAmount / intYears
intNumberPayments = doubleMonthlyInterest + doubleAmortization
doubleBalance -= doubleAmortization

Years.Text = intYears.ToString()
intNumberPayments.ToString()
doubleMonthlyInterest.ToString()
doubleMonthlyPrinciple.ToString()

If intLoanAmount > doubleBalance Then
intNumberPayments = intLoanAmount
End If
intLoanAmount = doubleAmortization - intLoanAmount
strTemp = "Payment" & intYears.ToString() & "Interest" & doubleMonthlyInterest.ToString() & "Principle" & intNumberPayments.ToString()
Me.TextBox.Items.Add(New ListViewItem(strTemp))


Next
Thanks so much. I am rid of my errors, now I have to figure out how to print all the details and not just the end results. :)
 
Back
Top