简体   繁体   中英

Manipulate a list within textbox textchange event in C# desktop application

I have a product list with 1000 item Now I want to search an item by textbox textchange event Let i want an item that contain "Pleate" as first or middle or last part of Item If i write "Pleate" in text box then manipulate a list/ Suggestion list which are contain with "Pleate"

Like following Image :

在此处输入图片说明

then i select a item from list as well as list will be vanish

Try something like this

var data = new[] { "Plate", "Table", "Cap" }; //Place your 'product list' into the IEnumerable<string> data
listBox.DataSource = data.Where(item => item.Contains(textBox.Text));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM