[AA+] Remove Duplicates From Listview
Fast way to Remove duplicates from ListView. I havn't seen anthing that is the same on PSC, so I hope this will help in the quest for a faster way to remove duplicate items from a listview.. though I really don't think there is a "Fast" way to do it.. Who knows.. ENJOY!
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Private Sub RemoveDuplicates(lst As ListView) Dim lRet As ListItem Dim strTemp As String Dim intCnt As Integer intCnt = 0 Do While intCnt <= lst.ListItems.Count - 1 intCnt = intCnt + 1 'Save the text that was in the listvew index strTemp = lst.ListItems.Item(intCnt).Text Do lst.ListItems.Item(intCnt).Text = "" 'Remove the text inside the specific index 'Use the FindItem() call to search for the specific item Set lRet = lst.FindItem(strTemp, lvwText, lvwPartial) 'If the item is found, then it is a duplicate and is removed If Not lRet Is Nothing Then lst.ListItems.Remove (lRet.Index) End If Loop While Not lRet Is Nothing 'If no item is found the loop is exited lst.ListItems.Item(intCnt).Text = strTemp 'reset the listitem index text back to what it was, and then continue Debug.Print intCnt DoEvents 'Added to ensure that the application does not lock up when doing large amounts of data. Loop End Sub
Original Comments (3)
Recovered from Wayback Machine