hi how can i make list view like this ?
http://myup.ir/images/64139266311095345064.jpg

ListView1.Items(1).BackColor = Color.LightGray
Dim grp As ListViewGroup
 grp = ListView1.Groups.Add("String", "String")

 Dim item As ListViewItem = New ListViewItem(grp)
        Dim remain As Integer
        Math.DivRem(ListView1.Items.Count, 2, remain)
        If remain <> 0 Then
            item.BackColor = Color.White
        Else
            item.BackColor = Color.WhiteSmoke
        End If

        item.Text = "Item String"
        item.SubItems.Add("sub item" )

        ListView1.Items.Add(item)

I use the Mod operator which returns the remainder.

Dim lvi As New ListViewItem
lvi.Text = "Hello"
If ListView1.Items.Count Mod 2 = 0 Then
    lvi.BackColor = Color.white
Else
    lvi.BackColor = Color.LightGray
End If
ListView1.Items.Add(lvi)

if you wanna have such list view items you should make a listview group

Dim grp As ListViewGroup

then you need items and maybe subitems for each row that is included in your group

Dim item As ListViewItem = New ListViewItem(grp)

you must apply your property on your items
and at the end add that item into your listview

thats not hard to understand :)

Be a part of the DaniWeb community

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