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

ListView SubItems Forecolor 1

Status
Not open for further replies.

bjd4jc

Programmer
Nov 8, 2001
1,627
US
I want to set the subitems in my listview control to a color other than black. I have got the ListItem (first column) to be red but I am unable to get the rest to be red.

Here is what I am doing:

Code:
Do While Not rsSchedule.EOF
        Set SchedItem = lstSchedule.ListItems.Add(, , rsSchedule("MO_NUMBER"))
        
        SchedItem.SubItems(1) = rsSchedule("SCHED_DATE")
        SchedItem.SubItems(2) = rsSchedule("ORDER_QTY")
        SchedItem.SubItems(3) = rsSchedule("WC_ID")
        
        If rsSchedule("ITEM") = txtXBundle Then
            SchedItem.ForeColor = vbRed
            SchedItem.SubItems(1).ForeColor = vbRed '<<=== Bombs out here.  Error: &quot;Invalid Qualifier&quot;
            SchedItem.SubItems(2).ForeColor = vbRed
            SchedItem.SubItems(3).ForeColor = vbRed
            
        End If
        rsSchedule.MoveNext
    Loop

Any ideas from anyone?
 
As far as I know, SubItems do not have a forecolor property. If you want full control of text color and back color you could try a Flexgrid
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
After doing some more playing I found a way to do this.

Instead of
SchedItem.SubItems(1).Forecolor = vbRed

It should be
SchedItem.ListSubItems(1).ForeColor = vbRed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top