How to change the color of a cell(back or fore color) of listview item according to item value with if condition.

I do it but it is not work and show no error
Please help me......

For k = 0 To ListView1.Items.Count - 1
If ListView1.Items(k).SubItems(6).Text > 100 Then
ListView1.Items(k).SubItems(6).ForeColor = System.Drawing.Color.Red
MsgBox("hi test code yes")
MsgBox("hi test code no")
End If

Next k

Asked and answered here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.