Aligning text in listboxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

To anyone who may see this message.

I am working on a VB2003project in which i have a list box to display
a list of cars with the following fields: Make, Model, Year, Mileage,
Price.
Each car has each of those fields. The list box displays one line per
car, each line having these fields. in order to left-align the text of each
field (i.e. all "make" fields aligned, all "model" fields aligned, etc). I
have tried every possible function to format my output.

When i try to use the PadRight() function on the individual fields (each
being cast a string), i still don't get the alignment. Basically, the
padright() function is not working properly.

Any suggestions?

Thanks
 
VBStudent said:
To anyone who may see this message.

I am working on a VB2003project in which i have a list box to display
a list of cars with the following fields: Make, Model, Year, Mileage,
Price.
Each car has each of those fields. The list box displays one line per
car, each line having these fields. in order to left-align the text of each
field (i.e. all "make" fields aligned, all "model" fields aligned, etc). I
have tried every possible function to format my output.

When i try to use the PadRight() function on the individual fields (each
being cast a string), i still don't get the alignment. Basically, the
padright() function is not working properly.

Any suggestions?

Thanks
PadRight is probably working allright. Your problem is probably
proportional fonts (which basically means that not all characters take
up the same horizontal space). Try setting the font for the listbox to a
non proportional font like 'Courier New' or 'Lucida Console'.
 
VBStudent said:
I am working on a VB2003project in which i have a list box to display
a list of cars with the following fields: Make, Model, Year, Mileage,
Price.
Each car has each of those fields. The list box displays one line per
car, each line having these fields. in order to left-align the text of
each
field (i.e. all "make" fields aligned, all "model" fields aligned, etc). I
have tried every possible function to format my output.


Use a listview control instead of the listbox.
 
Back
Top