Results 1 to 11 of 11

Thread: Add Color on specific listbox row

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    20

    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

  2. #2

  3. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    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

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Add Color on specific listbox row

    You could also use a Flexgrid to separate the data into columns

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    20

    Re: Add Color on specific listbox row

    flexgrid is more complicated rite?

    where to find listview?

  6. #6

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Sep 2005
    Posts
    20

    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

  9. #9
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

  10. #10

  11. #11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width