|
-
January 25th, 2011, 01:01 AM
#1
Search listbox for string and return index
I want to search a listbox control that has a list of usernames. I am developing an irc client and when the user leaves it calls and event with that user. This event needs to search the listbox full of users, return the index of the item in the listbox then remove it.
I have tried:
ListBox lst = _List(split[2].ToString()); //This just grabs the listbox that is on the tab of the correct
//channel.
foreach (object o in lst.Items)
{
if (o.ToString() == user)
{
lst.Items.Remove(o);
}
}
That does not work though. Any help is appreciated and thanks in advance.
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
|