How to filter items in a ListBox based on a searched string

Posted by tiz on Stack Overflow See other posts from Stack Overflow or by tiz
Published on 2010-05-06T13:16:19Z Indexed on 2010/05/06 13:18 UTC
Read the original article Hit count: 129

Filed under:
|

Hi all,

I have a Windows Forms application (C#) containing a ListBox into which I have added some items (I'm not using a DataSource). I want to filter the items in the ListBox to show only items containing a string I'm searching for.

I have done this by keeping a list of the original items and selecting matching items from that list each time the search string changes and updating the ListBox.Items

Is there a more elegant/efficient way to do this?

© Stack Overflow or respective owner

Related posts about windows-forms

Related posts about c#