I am trying to populate a listbox and I can not figure out how to tab the items over
1
325.00
54.00
2
326.00
84.00
. . .
and I need to
1 325.0 54.00
2 326.00 84.00
Dim decLoanAmount As Decimal
Dim intYears As Integer
Dim decInterestRate As Decimal
Dim decTotalPayback As Decimal
Dim decPaymentDue As Decimal
Dim listitems() As String
Dim i As Integer
'convert the loan Amount input to a decimal
decLoanAmount = CDec(txtLoanAmount.Text)
'convert years selected to decimal and multiply it by 12 months
intYears = CDec(ddlYears.SelectedValue) * 12
' convert Interest rate to decimal and devide by 100
decInterestRate = CDec(txtInterestRate.Text) / 100
' calculate payment due
decPaymentDue = (decLoanAmount * (1 + decInterestRate)) / intYears
'calculate total payment of the loan
decTotalPayback = (decLoanAmount * (1 + decInterestRate))
'display payment due on screen as result of postback
lblPaymentDue.Text = FormatNumber(decPaymentDue, 2)
'display total payments of the loan on postback
lblTotalPayback.Text = FormatNumber(decTotalPayback, 2)
For i = 1 To intYears
'listitems = CStr(decPaymentDue)
lstPayments.Items.Add(i)
lstPayments.Items.Add(Pmt(decInterestRate / 12, i, intYears, decLoanAmount, 0, 0))
lstPayments.Items.Add(IPmt(decInterestRate / 12, i, intYears, decLoanAmount, 0, 0))
Next
End Sub
1
325.00
54.00
2
326.00
84.00
. . .
and I need to
1 325.0 54.00
2 326.00 84.00
Dim decLoanAmount As Decimal
Dim intYears As Integer
Dim decInterestRate As Decimal
Dim decTotalPayback As Decimal
Dim decPaymentDue As Decimal
Dim listitems() As String
Dim i As Integer
'convert the loan Amount input to a decimal
decLoanAmount = CDec(txtLoanAmount.Text)
'convert years selected to decimal and multiply it by 12 months
intYears = CDec(ddlYears.SelectedValue) * 12
' convert Interest rate to decimal and devide by 100
decInterestRate = CDec(txtInterestRate.Text) / 100
' calculate payment due
decPaymentDue = (decLoanAmount * (1 + decInterestRate)) / intYears
'calculate total payment of the loan
decTotalPayback = (decLoanAmount * (1 + decInterestRate))
'display payment due on screen as result of postback
lblPaymentDue.Text = FormatNumber(decPaymentDue, 2)
'display total payments of the loan on postback
lblTotalPayback.Text = FormatNumber(decTotalPayback, 2)
For i = 1 To intYears
'listitems = CStr(decPaymentDue)
lstPayments.Items.Add(i)
lstPayments.Items.Add(Pmt(decInterestRate / 12, i, intYears, decLoanAmount, 0, 0))
lstPayments.Items.Add(IPmt(decInterestRate / 12, i, intYears, decLoanAmount, 0, 0))
Next
End Sub