Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

listbox to tab over items

Status
Not open for further replies.

EBee

MIS
Aug 10, 2001
229
0
0
US
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
 
You could use a listview control and then use the subitems to populate the columns. You can find an example of how it works by doing a search on listview in VB.Net help.
 
Vrite so:

For i = 1 To intYears
'listitems = CStr(decPaymentDue)
dim Aa as String
Aa=i & vbTab & Pmt(decInterestRate / 12, i, intYears, decLoanAmount, 0, 0)) & vbTab & IPmt(decInterestRate / 12, i, intYears, decLoanAmount, 0, 0))
lstPayments.Items.Add(Aa)

Next
Miho
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top