【问题标题】:How can I find listbox item index with item value?如何找到具有项目值的列表框项目索引?
【发布时间】:2013-07-10 19:07:27
【问题描述】:

我的

MessageBox.Show(listbox.Items[0].ToString());

"abber"

如何使用“abber”找到列表框项索引 0?

【问题讨论】:

  • 请说明您的要求

标签: c# windows-phone-7 listbox indexing


【解决方案1】:

listbox.Items.IndexOf("abber")

即:

int curIndex = listbox.Items.IndexOf("abber");
if(curIndex >= 0)
{
    MessageBox.Show(listbox.Items[curIndex].ToString());
}

【讨论】:

    【解决方案2】:
     int index = listBox1.Items.IndexOf("Specify string here");
    

    【讨论】:

      猜你喜欢
      • 2010-09-15
      • 1970-01-01
      • 1970-01-01
      • 2022-11-21
      • 2016-01-25
      • 1970-01-01
      • 2023-01-10
      • 2014-10-13
      • 1970-01-01
      相关资源
      最近更新 更多