|
-
Mar 26th, 2003, 06:16 PM
#1
Thread Starter
Addicted Member
(Resolved) Removing Items from listbox
I have a string called "Alias". Basically when a user quits the program I need lstUsers list to remove the value of "Alias" from the list. How do I do that???
Last edited by Illiad; Mar 26th, 2003 at 07:14 PM.
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
-
Mar 26th, 2003, 06:27 PM
#2
VB Code:
Dim indx As Long
'If you wan't to remove [b]all[/b] instances of "Alias"
For indx = List1.ListCount - 1 To 0 Step -1
If List1.List(indx) = "Alias" Then List1.RemoveItem indx
Next
'Or
'If you wan't to remove [b]one[/b] instance of "Alias"
Dim indx As Long
For indx = List1.ListCount - 1 To 0 Step -1
If List1.List(indx) = "Alias" Then
List1.RemoveItem indx
Exit For
End If
Next
Last edited by Bruce Fox; Mar 26th, 2003 at 06:30 PM.
-
Mar 26th, 2003, 06:41 PM
#3
Fanatic Member
You may have to watch your CAPS in comparing strings. I have had trouble in the past where "Alias" is not the same as "alias".
If you know uppercase/lowercase the text is in then you are OK otherwise use the Ucase() function to change both strings to the same case.
-
Mar 26th, 2003, 07:13 PM
#4
Thread Starter
Addicted Member
I said I made a varaible called Alias. Alias is the var! its contents are what im removing, not the word Var....just cauz im a Junior Member dosnt mean i dont know some programming stuff....
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
-
Mar 26th, 2003, 07:44 PM
#5
Fanatic Member
OK I guess we both misread your post. Use Bruce Fox's code but put your variable at the correct place and be careful of upper and lowercase characters.
I remember being junior once.
-
Mar 26th, 2003, 08:00 PM
#6
Thread Starter
Addicted Member
Yea I'm getting there....
Thanks for the heads up anyways i found the " around the word Alias in Brute's code and deleted them. The code works wonderfully now!
Quis Custodiet Ipsos Custodes?
You don't have to be faster than the bear, you just have to be faster than the slowest person running from the bear.
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
|