adding items to listbox

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

adding items to listbox

 
0
  #1
Nov 8th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 169
Reputation: ptaylor965 is an unknown quantity at this point 
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: adding items to listbox

 
1
  #2
Nov 8th, 2007
You will need to add the extra spaces to make up the gaps
  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
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

Re: adding items to listbox

 
0
  #3
Nov 13th, 2007
Thanks ptaylor965. I got it fixed.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 7602 | Replies: 2
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC