Add Color on specific listbox row
hi..hope some can help me..
currently iam using listbox to display content of the INI file..
..is there a way to change the background color of the listbox row to red when the status data is "No Response"?
here the example of the listbox display..
Prog01 0 0 23456789012345 000012 Inactive
Prog02 1 1 23456789012345 000014 Shutdown Request
Prog03 1 1 23456789012345 012345 No Response
i want the row with No Response to be displayed in red background color..
thnx
SiraJ
Re: Add Color on specific listbox row
Too much trouble for that... You would have to subclass Listbox so it will become owner drawn... Instead, I would suggest to use Listview control so you can easily set any color you want for any Item/SubItem.
Re: Add Color on specific listbox row
You will need to Subclass the ListBox, here is an example: http://www.vbforums.com/showthread.p...=color+listbox
Re: Add Color on specific listbox row
You could also use a Flexgrid to separate the data into columns
Re: Add Color on specific listbox row
flexgrid is more complicated rite?
where to find listview?
1 Attachment(s)
Re: Add Color on specific listbox row
The listview is in Project|Components in Microsoft Windows Common Controls 6.0 and I've attached a simple project that uses it.
Re: Add Color on specific listbox row
I've found the flexgrid to be easier to use, and more adaptable than a listview.
You can refer to the textmatrix() for each row and column, without having to separate them, such as you do with a listview.
Take a look at this sample, which lists a few of the features of the flexgrid.
It is easy to bind to a database, or load from a textfile. You can also deal with issues of each cell very easily.
http://vbforums.com/attachment.php?attachmentid=40991
Re: Add Color on specific listbox row
thnx for the simple project, Martin
hi dglienna,
can flexgrid have exactly same interface as in listbox ?
how to remove the boxes in flexgrid?
thnx
Re: Add Color on specific listbox row
You remove a whole row at a time by moving all the other rows up one, and reducing the total number of rows in the grid. You add rows by moving rows below down by one after you increase the number of rows.
A listbox is better if you have only one field, but if you have multiple fields, and want to use different formats for each field, I think the flexgrid is best.
Re: Add Color on specific listbox row
you can always use multiple listboxes (some do, i wouldnt)
Re: Add Color on specific listbox row
Quote:
Originally Posted by BrailleSchool
you can always use multiple listboxes ...
To do what?