Results 1 to 2 of 2

Thread: Listview and Subitems question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    66
    Hello,

    I would like to change the text color in a Listview control for all the lines that are Ghosted but the problem is that the text color is changed only in the first column and not for all SubItems.

    Thanks for your help,

    Thierry Demoy
    France

    VB6

  2. #2
    Guest
    You would have to change the ForeColor on each ListSubItem of the ListItem you were changing. For example:

    Code:
      Dim lngColor As Long
      Dim intSubIndex As Integer
      
      lngColor = RGB(128, 128, 128)
      
      With ListView1
        .ListItems(1).ForeColor = lngColor
        For intSubIndex = 1 To .ListItems(1).ListSubItems.Count
          .ListItems(1).ListSubItems(intSubIndex).ForeColor = lngColor
        Next intSubIndex
        .Refresh
      End With
    This example just does one ListItem. You could do a loop to modify more than one.

    Paul

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