我的
MessageBox.Show(listbox.Items[0].ToString());
是
"abber"
如何找到带有“abber”的列表框项目索引 0?
最佳答案
使用 listbox.Items.IndexOf("abber")
即:
int curIndex = listbox.Items.IndexOf("abber");
if(curIndex >= 0)
{
MessageBox.Show(listbox.Items[curIndex].ToString());
}
关于c# - 如何找到具有项目值的列表框项目索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17611537/