| | |
adding items to listbox
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2007
Posts: 13
Reputation:
Solved Threads: 0
Hey I'm trying to add information to a listbox, but when i try this code it doesn't display it properly.
Dim fmtstr As String = "{0,-10}{1,12}{2,14}"
With lstservices.Items
.Clear()
.Add(String.Format(fmtstr, "Room Rentals", "Half-Day", "Full-Day"))
.Add(String.Format(fmtstr, "1. Standard Rooming", "$32.00", "$65.00"))
.Add(String.Format(fmtstr, "2. Deluxe Rooming", "$72.00", "$144.00"))
End With
I want the results to show under each of the proper category, not all over the place.
Dim fmtstr As String = "{0,-10}{1,12}{2,14}"
With lstservices.Items
.Clear()
.Add(String.Format(fmtstr, "Room Rentals", "Half-Day", "Full-Day"))
.Add(String.Format(fmtstr, "1. Standard Rooming", "$32.00", "$65.00"))
.Add(String.Format(fmtstr, "2. Deluxe Rooming", "$72.00", "$144.00"))
End With
I want the results to show under each of the proper category, not all over the place.
Last edited by Magnusz; Nov 8th, 2007 at 11:59 am.
You will need to add the extra spaces to make up the gaps and change the font to "Courier New" as the letter 'i' and 'O' use the same amount of space in this font
VB.NET Syntax (Toggle Plain Text)
Dim fmtstr As String = "{0,-10}{1,12}{2,14}" With lstservices.Items .Clear() .Add(String.Format(fmtstr, "Room Rentals ", "Half-Day ", "Full-Day")) .Add(String.Format(fmtstr, "1. Standard Rooming ", "$32.00 ", "$65.00")) .Add(String.Format(fmtstr, "2. Deluxe Rooming ", "$72.00 ", "$144.00")) End With
![]() |
Similar Threads
- To drag and drop multiple listbox items from one listbox control to another (ASP.NET)
- Looping through listbox items (JavaScript / DHTML / AJAX)
- listbox multiple selection (ASP.NET)
- Listbox Items as an array (ASP.NET)
- Send all items in a listBox to SQL server database table (ASP.NET)
- Combo Box (C++)
- help with adding items to a linked list. (Java)
- Adding Totals from Listbox DB (DAO) (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: can somebody help m or give m code....!!
- Next Thread: Query about VB.net Design
Views: 7602 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access add advanced application array basic beginner browser button buttons center class click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker design designer dissertation dissertations dissertationtopic eclipse employees excel exists forms function html images lib listview map mobile module msaccess mysql net number open page pan pdf picturebox picturebox2 port position print printing printpreview problem refresh regex reuse richtextbox right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure studio textbox timer timespan transparency txttoxmlconverter usercontol vb vb.net vb2008 vba vbnet vista visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winsock wpf wrapingcode xml year





