CODE
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub BtnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnExit.Click
'Exit the project.
Me.Close()
End Sub
Private Sub BtnCalculatePayments_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalculatePayments.Click
'Declaring the variables
Dim intInterestRateAmt As Decimal
Dim intLoanAmt As Decimal
Dim intLoanPeriodAmt As Decimal
Dim strOutput As Decimal
Dim decTotalPaid As Decimal
Dim decMonthlyPayment As Decimal
Dim dblInterestRateAmt As Decimal
Dim dblPrincipal As Decimal
Dim intNumberOfPayments As Integer
Dim dblEndingInterestRateAmt As Decimal
Dim dblStartingInterestRateAmt As Decimal
Dim dblEndingInterestRate As Decimal
Dim dblStartingInterestRate As Decimal
Dim dblInterestRate As Decimal
strOutput = "Number of Payments" & ControlChars.Tab & ControlChars.Tab & "Interest Rate" & ControlChars.Tab & "Monthly Payments" & _
ControlChars.Tab & " Total Paid"
strOutput &= ControlChars.NewLine & "Number of Payments" & ControlChars.Tab & "Interest Rate" & _
ControlChars.Tab & ControlChars.Tab & "Monthly Payment" & ControlChars.Tab & "Total Paid"
dblPrincipal = Val(Me.TxtLoanAmt.Text)
dblInterestRate = Val(Me.TxtInterestRateAmt.Text)
dblStartingInterestRate = dblInterestRateAmt - 0.05
dblEndingInterestRate = dblInterestRateAmt + 1
intNumberOfPayments = Val(Me.TxtLoanPeriodAmt.Text)
For dblInterestRateAmt = dblStartingInterestRate To dblEndingInterestRate Step 0.05
decMonthlyPayment = Pmt(dblInterestRateAmt / 100 / 12.0, intNumberOfPayments, -dblPrincipal)
decTotalPaid += decMonthlyPayment
strOutput &= ControlChars.NewLine & String.Format("{0:D}", intNumberOfPayments) & ControlChars.Tab _
& ControlChars.Tab & String.Format("{0:F2}", dblInterestRate) & ControlChars.Tab _
& ControlChars.Tab & String.Format("{0:C2}", decMonthlyPayment) &
ControlChars.Tab _
& String.Format(" {0:C2}", decTotalPaid)
Next
Me.TxtResults.Text = strOutput
End Sub
Private Sub TxtResults_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtResults.TextChanged
End Sub
End Class
The errors that I am receiving are:
Error 1 Expression Expected (This is for the & after"decMonthlyPayment)
Error 2 Expression is not a method. This is for the ControlChars.Tab in the next to the last line.
Error 3 Expression Expected. This is for the & sign in the line before "Next"
Error 4 Method must be enclosed in parenthesis. This is showing the as being the same & sign as the error before.
I'm not sure why I got these errors, or even how to fix them. These are to display results in a table from calculations made for payment information. Any suggestions would be greatly appreciated.
This post has been edited by jayman9: 17 Nov, 2007 - 11:47 PM