Basha Sk


Hi All,

I am having two Listboxes. The ListBox1 is having some items and the ListBox2 is used to display the SubItems of the ListBox1 items. If i select two items in ListBox1 then these two items subItems will be dispalyed in ListBox2. So How can i differentiate these subItems with respect to their Parent items. Is it possible to set ForeColor to each item of a ListBox. Thanks in Advance.....

Basha




Re: ListBox Item Color

Andy Pope


Hi,

The standard listbox control within VBA does not support multiple formatting. All items have the same format.

You could use a 2 column listbox for the subitems and include the parent text from listbox1 in either the first of second column. Or if you only want 1 column simply append the 2 texts.

You could try using the Listview control that comes with windows. This does have the ability to format each item.






Re: ListBox Item Color

Basha Sk

Hi Andy,

Thanks for the reply. Do u have any sample for ListView control. Thanks in Advance.......

Regards,

Basha






Re: ListBox Item Color

Andy Pope

http://www.dailydoseofexcel.com/archives/2006/12/26/listview/

One of many examples return via google.





Re: ListBox Item Color

Basha Sk

HI Andy,

Thanks for the reply. It helps me a lot.

Regards,

Basha