AndyK
January 18th, 2000, 10:18 PM
For example if I have SMTP_HOST twice in listbox, how can i eliminate on of them so basically i need to remove all double entries in my listbox leaving only those that are different
Thank You
Thank You
|
Click to See Complete Forum and Search --> : Deleting strings from listbox AndyK January 18th, 2000, 10:18 PM For example if I have SMTP_HOST twice in listbox, how can i eliminate on of them so basically i need to remove all double entries in my listbox leaving only those that are different Thank You Lothar Haensler January 19th, 2000, 01:53 AM try this code. It makes all entries unique private Sub Command1_Click() List1.AddItem "test" List1.AddItem "test" List1.AddItem "test" List1.AddItem "second" List1.AddItem "second" List1.AddItem "second" List1.AddItem "second" List1.AddItem "second" List1.AddItem "third" List1.AddItem "third" End Sub Sub makeUnique(l as ListBox) Dim i as Integer for i = l.ListCount - 1 to 0 step -1 If l.List(i) = l.List(i - 1) then l.RemoveItem i End If next i End Sub Lothar Haensler January 19th, 2000, 02:21 AM ...sample assumes "Sorted = True" for the listbox... coolily January 20th, 2000, 10:09 PM isnt it even better if sorted=false? AndyK January 23rd, 2000, 11:31 PM If I set sorted = false then it won't give me a right solution, I need to have it set to True. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |