tested with:
Code: Select all
If ICO = 1 Then
Me.ListView1.ListItems(X).ListSubItems(2).ForeColor = &H8000&
End If
Note:
X is the value from a loop in listcount
Code: Select all
If ICO = 1 Then
Me.ListView1.ListItems(X).ListSubItems(2).ForeColor = &H8000&
End If
ok i know this way... but difficut to set the first cell!HansV wrote:You could loop through the subitems to color each of them.
ERROR!!!!!!!!!!!HansV wrote:Perhaps VB - Color a row in a ListView will help, or else how to change back color for listview alternately for rows.
Code: Select all
Sub LOOP_COLOR()
Dim itmX As ListItem
Dim LINEA As Long
'INSERIRE LA CONDIZIONE PER ROWSET ROSSO
For LINEA = 1 To Me.ListView1.ListItems.Count
If Me.ListView1.ListItems(LINEA).SubItems(2) = "05" Then
Dim lvSI As ListSubItem
Dim intIndex As Integer
For intIndex = 1 To Me.ListView1.ColumnHeaders.Count - 1
Set lvSI = itmX.ListSubItems(intIndex)<<<<<<<<<<<<<<<<<< error 91
lvSI.ForeColor = vbRed
Next
End If
Next LINEA
'INSERIRE LA CONDIZIONE PER ROWSET ROSSO
End Sub
Code: Select all
Sub LOOP_COLOR()
Dim itmX As ListItem
Dim LINEA As Long
'INSERIRE LA CONDIZIONE PER ROWSET ROSSO
For LINEA = 1 To Me.ListView1.ListItems.Count
Set itmX = Me.ListView1.ListItems(LINEA) ' ***** Added line ****
If itmX.SubItems(2) = "05" Then
Dim lvSI As ListSubItem
Dim intIndex As Integer
For intIndex = 1 To Me.ListView1.ColumnHeaders.Count - 1
Set lvSI = itmX.ListSubItems(intIndex)
lvSI.ForeColor = vbRed
Next
End If
Next LINEA
'INSERIRE LA CONDIZIONE PER ROWSET ROSSO
End Sub