Dim intYears As Integer 'Number of years invested
Dim dblRate As Double 'Declares the interst rate as a double
Dim sngNUMBER_YEAR As Single = 1
Dim intCount As Integer 'Counter for the loop
Dim dblPrincipal As Double 'Decalares the Principal as Double
Dim dblInterest As Double
'Get the number of years and calculate the amount of interest
intYears = CInt(txtInvested.Text)
dblPrincipal = CDbl(txtPrincipal.Text)
'Calculate the yearly payments
dblPayment = Pmt(dblRate / sngNUMBER_YEAR, _
intYears, -dblPrincipal)
For intCount = 1 To intYears
'Holds list box output
Dim strOut As String = String.Empty
'Add the year to the output string
strOut = intCount.ToString
dblInterest = IPmt(dblRate / sngNUMBER_YEAR, _
intCount, intYears, -dblPrincipal)
dblAmount = dblPayment + dblInterest
lstDisplay.Items.Add("Year " & intCount.ToString & dblAmount.ToString("c"))
Next