Column1
AAA
BBB
CCC
AAA
DDD
In this case, both the first and fourth one will be deleted. The final output will be
Column1
BBB
CCC
DDD
Here's my code
Dim RemovedItemsIndexs As New Collection
Dim ctr, ctr2 As Integer
ctr = 0
Dim listviewctr As Integer = ListView3.Items.Count
listviewctr = listviewctr - 1
Do
ctr2 = 0
Do
If ListView3.Items.Item(ctr).Text = ListView3.Items.Item(ctr2).Text And ListView3.Items(ctr).SubItems(1).Text = ListView3.Items(ctr2).SubItems(1).Text Then
If Not RemovedItemsIndexs.Contains(ctr) Then
RemovedItemsIndexs.Add(ctr, ctr)
End If
If Not RemovedItemsIndexs.Contains(ctr2) Then
RemovedItemsIndexs.Add(ctr2, ctr2)
End If
End If
If ctr2 <> listviewctr Then
ctr2 = ctr2 + 1
Else
GoTo down
End If
Loop Until ctr = listviewctr + 1
down:
ctr = ctr + 1
Loop Until ctr = listviewctr + 1
For index As Integer = 1 To RemovedItemsIndexs.Count
ListView3.Items.RemoveAt(RemovedItemsIndexs(index))
Next
Please help, Thank you.