[英]Manipulate a list within textbox textchange event in C# desktop application
我有一個包含1000個項目的產品列表,現在我想通過文本框textchange事件搜索一個項目,讓我想要一個包含“ Pleate”作為項目的第一部分,中間部分或最后一部分的項目。如果我在文本框中輸入“ Pleate”,然后操作包含在“ Pleate”中的列表/建議列表
像下面的圖像:
然后我從列表中選擇一個項目,以及列表將消失
試試這個
var data = new[] { "Plate", "Table", "Cap" }; //Place your 'product list' into the IEnumerable<string> data
listBox.DataSource = data.Where(item => item.Contains(textBox.Text));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.