|
-
January 18th, 2000, 11:18 PM
#1
Deleting strings from listbox
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
-
January 19th, 2000, 02:53 AM
#2
Re: Deleting strings from listbox
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
-
January 19th, 2000, 03:21 AM
#3
Re: Deleting strings from listbox
...sample assumes "Sorted = True" for the listbox...
-
January 20th, 2000, 11:09 PM
#4
Re: Deleting strings from listbox
isnt it even better if sorted=false?
-
January 24th, 2000, 12:31 AM
#5
Re: Deleting strings from listbox
If I set sorted = false then it won't give me a right solution, I need to have it set to True.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|