这是我的代码:
foreach(var item in listBox1.Items)
{
string i = item.ToString();
if (item.ToString()== "myItem")
{
label1.Text = i.ToString(); // how to get the founded item index?
break;
}
}
ListBox
中有一个循环用于查找特定项目。找到该项后,我想知道ListBox
中该项的索引是什么?