2020年5月18日 星期一

vb.net Listview讓指定的字串排在一起 [Listview group item]


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    Private Sub LVWSetOrder(lvw As ListView)

        For i As Integer = lvw.Items.Count - 1 To 1 Step -1

            If lvw.Items.Item(i).BackColor = Color.Gold Then

                If lvw.Items.Item(i).Text = lvw.Items.Item(i - 1).Text Then

                    Dim tItem As ListViewItem


                    tItem = lvw.Items(i - 1)


                    lvw.Items.Insert(i - 1, lvw.Items(i).Clone)

                    lvw.Items.RemoveAt(i + 1)


                End If

            End If

        Next

    End Sub

沒有留言:

張貼留言