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.