如何在列表框中搜索特定文本并在文本框中显示它,请 [英] How to search for specific text in listbox and display it textbox,please

查看:67
本文介绍了如何在列表框中搜索特定文本并在文本框中显示它,请的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

再次向大家致敬
我是初学者,

Hii again Everyone
i''m beginner,
How to search for specific text in listbox and display it textbox,please.

推荐答案

亲爱的哈桑,

在ListBox控件上应用一个foreach循环,如下所示:-

Dear Hassan,

Apply a foreach loop on the ListBox control like this:-

foreach(String str in lstBox.Items)
{
  if(str.SelectedText=="[Text u want to show in textbox"])
  {
    textBox.Text=str.SelectedText;
  }
}



如果有帮助,请在回答时将其标记出来.

谢谢



Mark this as you answer if it helps you out.

Thanks


,您可以通过以下方式进行操作:

you can do in this way:

ListViewItem foundItem =
        textListView.FindItemWithText(searchBox.Text, false, 0, true);
    if (foundItem != null)
    {
        textListView.TopItem = foundItem;

    }



希望对您有帮助.
如果有帮助,别忘了将其标记为答案. :)



Hope this will help you.
And dont forget to mark as answer if it helps. :)


这篇关于如何在列表框中搜索特定文本并在文本框中显示它,请的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆