| Use this method to avoid adding an item to a ListBox that already exists. It's a lot faster and shorter than submissions that uses loops etc. By: Fredrik Schultz Inputs:StringToAdd = the string to add (if not already exists) lst = your ListBox Private Sub AddUnique(StringToAdd As String, lst As ListBox) lst.Text = StringToAdd If lst.ListIndex = -1 Then 'it does not exist, so add it.. lst.AddItem StringToAdd End If End Sub |
Add only unique items to a listbox |
Express News India | Freelance ecommerce web development India