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

Color code the items in the List Box

Status
Not open for further replies.

billyng

Programmer
Dec 7, 2004
25
US
Hi folks,

I have a ListBox that list all the items in different categores. Since there are too many, I want the items to be color coded base on their categories. Is it possible?

Thanks!

Billy
 
Billy

Perhaps you can start by looking looking at thread184-462921. Please not that this technique only work via code, it cannot be done with the designer.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Billy,

Mike Gagnon has given you one good possibility. Another is to use a grid instead of a listbox. With grids, you can use the Dynamic... properties for format items based on some condition.

You mentioned that you have "too many" items. An advantage of a grid is that it works equally well with large numbers of items, whereas a listbox doesn't work so well with more than a few dozen or a few hundrend entries (depending on version and configuration).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-consult.com)
 
Given that there are Categories, I would suggest using a treeview control (if you don't mind a little ActiveX dependence). It will allow you to group the items beneath the different categories and you can even assign to each a different icon representing the category it is a member of. Also, it allows users to still make selections and can even include checkboxes for making multiple selections.

boyd.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top