VB Code:
  1. Private Sub RemoveDuplicates(list As ListBox)
  2.     Dim i As Integer, x As Integer
  3.     For i = 0 To list.ListCount - 1
  4.         For x = 0 To list.ListCount - 1
  5.             If i <> x Then
  6.                 If list.list(i) = list.list(x) Then
  7.                     list.RemoveItem (x)
  8.                 End If
  9.             End If
  10.         Next x
  11.     Next i
  12. End Sub
  13.  
  14. Private Sub Cmdremove_Click()
  15.     Call RemoveDuplicates(List1)
  16. End Sub
this is what im using to remove duplicates from listbox but if i have for example three A's and 3 B's and when i click to deduple it will only remove one A and one B so i would still have some duped to fix this i would have to keep on clicking dedupe how can i fix this?