943,724 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 15955
  • VB.NET RSS
Nov 8th, 2007
0

adding items to listbox

Expand Post »
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.
Last edited by Magnusz; Nov 8th, 2007 at 11:59 am.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Magnusz is offline Offline
13 posts
since Oct 2007
Nov 8th, 2007
1

Re: adding items to listbox

You will need to add the extra spaces to make up the gaps
VB.NET Syntax (Toggle Plain Text)
  1. Dim fmtstr As String = "{0,-10}{1,12}{2,14}"
  2. With lstservices.Items
  3. .Clear()
  4. .Add(String.Format(fmtstr, "Room Rentals ", "Half-Day ", "Full-Day"))
  5. .Add(String.Format(fmtstr, "1. Standard Rooming ", "$32.00 ", "$65.00"))
  6. .Add(String.Format(fmtstr, "2. Deluxe Rooming ", "$72.00 ", "$144.00"))
  7. End With
and change the font to "Courier New" as the letter 'i' and 'O' use the same amount of space in this font
Reputation Points: 16
Solved Threads: 19
Junior Poster
ptaylor965 is offline Offline
169 posts
since Oct 2006
Nov 13th, 2007
0

Re: adding items to listbox

Thanks ptaylor965. I got it fixed.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Magnusz is offline Offline
13 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: can somebody help m or give m code....!!
Next Thread in VB.NET Forum Timeline: Query about VB.net Design





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC