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

Can you force a listbox to tab align multiple columns 1

Status
Not open for further replies.

WantsToLearn

Programmer
Feb 15, 2003
147
0
0
US
Hello,

I do more VBA than VB so please bear with me. I have several listboxes with similar data that I am keeping in sync manually. Is it possible to combine all of the data into one list box and have everything column aligned properly? Here is the type of thing I have:
Code:
lstFName lstLName    lstCity 
Jim      Worthington Kalamazoo
Katarina Joe         Troy
Here is what I would like:
Code:
lstAllData
Jim      Worthington Kalamazoo
Katarina Joe         Troy
Thanks for any ideas!
 
The only way I've been able to do this using a "ListBox" is to limit data in each "column" to a set lenght and either truncate if exceeded...

Having said that, once you've set up your column parameters, you'll have to "pad" each column with spaces to get them to line up correctly. And then you'll need to use a "fixed width" font so everything looks neat and tidy.

_______
I love small animals, especially with a good brown gravy....
 
Yes, it can be done - but requires resort to the API and sending a message to the listbox to set up support for Tabs. Is this a route you want/need to go?
 
Hello strongm,

Thanks for your reply. I have done some simple things with the APIs so I am willing to try something like that. I have used the PostMessage API to shut down a related application so I am at least a little bit familiar with the concept.

If you would be kind enough to point me I would appreciate it. Once I know a little bit where to look, I can also go to AllAPI.net and dig around. They usually have excellent examples.

Now that I have read your post, something is niggling at the back of my mind that I saw something along those lines somewhere quite a while ago.

As an aside, I have appreciated the breadth and depth of your knowledge on the boads. Thank you very much for your willingness to share. People like you are one of the reasons why I almost always check Tek-Tips first when I need a question answered. Thanks again for your helpfulness!
 
Perhaps a different way to approach your situation is to use ListView instead of Listbox.

_______
I love small animals, especially with a good brown gravy....
 
There we go. Looks like you got the info you needewd. Have fun.
 
Thank you, everything is working very well thanks to the information provided above. Where do I find information about a ListView? Thanks again!
 
KIM that you cannot print the listbox, as the tabs don't get passed to the printer. You might have better luck with the msflexgrid. It is easily customizeable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top