For i As Integer = 0 To ListView1.Items.Count - 1
ListView1.Items(i).UseItemStyleForSubItems = False
'Set color for the second column
If ListView1.Items(i).SubItems.Count > 1 Then
ListView1.Items(i).SubItems(2).BackColor = Color.Green
End If
'Set Color for the 4e Column
If ListView1.Items(i).SubItems.Count > 1 Then
ListView1.Items(i).SubItems(4).BackColor = Color.Yellow
End If
Next
For Each item As ListViewItem In Me.ListView1.Items
With item
.UseItemStyleForSubItems = False
If .SubItems.Count > 1 Then
.SubItems(2).BackColor = Color.Green
.SubItems(4).BackColor = Color.Yellow
End If
End With
Next