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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox Control Problem 1

Status
Not open for further replies.

svagelis

Programmer
May 2, 2001
121
GR
i m having problems to align strings in columns.
i mean that i want to display in every line of the listbox
3-4 columns (ex name,surname,parentname etc). i m using vbtab to separate each string from the other ex.

lstbox.additem "Schwarzenegger" & vbtab & "Anrold" & vbtab & "Gustav"
lstbox.additem "Smith" & vbtab & "Joe" & vbtab & "Niko"


but when i have length differences > 7 then have bad alignment
can u help?
 
You know what the problem is, so the solution is to make each type of data the same length.

Lets say that the last name has been already dimmed as lname and contains the string 'Smith'

lname = lname & space(15-len(lname)) 'this will append 10 spaces after 'Smith'

If you use this routine on each lname, then they will all have a length of 15.
Your data may still not line up, but if you use a mono spaced font like courier in the listbox it will fix that.
David Paulson


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top