vb.net different color in listview lines

VB.net – Each listview line in a different color

This is how to make each line in a listview xhave a different color.

The listview in this example is named “lv”.

                Dim myRow As ListViewItem
                Dim RowCount As Integer = 0
                For Each myRow In lv.Items
                    If RowCount Mod 2 = 0 Then
                        myRow.BackColor = Color.Silver
                    Else
                        myRow.BackColor = Color.LightGray
                    End If
                    RowCount = RowCount + 1
                Next

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.