| Sub NoDuplicatesInList(lst As ListBox, str As String) Dim tf As Boolean Dim x As Integer If lst.ListCount = 0 And str <> "" Then lst.AddItem str 'check to make sure no duplicate entries get into list box Else tf = False For x = 0 To lst.ListCount - 1 If lst.List(x) <> str Then tf = False Else tf = True Exit For End If Next x If tf = False And str <> "" Then lst.AddItem str End If End If End Sub |
Ensure No Duplicate Entries are Added to a ListBox |
Express News India | Freelance ecommerce web development India