Reputation: 197
my
MessageBox.Show(listbox.Items[0].ToString());
is
"abber"
how can I find listbox item index 0 with "abber"?
Upvotes: 9
Views: 38882
Reputation:
With listbox.Items.IndexOf("abber")
That is:
int curIndex = listbox.Items.IndexOf("abber");
if(curIndex >= 0)
{
MessageBox.Show(listbox.Items[curIndex].ToString());
}
Upvotes: 20