implementing filter for listbox in windows application
-
how to implement Filter for listbox using textbox in windows application using vb.net i have a textbox and a listbox in my application listbox id binded from database.. now when the user enters anything in textbox the items which starts with the text enterd in the listbox should filter and come in the first (i mean list box is already filled in ascending order,so only the thing is the scroll should move to the starting of the word which is enterd in the textbox ) how can i achieve this? any idea?.. (same like the index search in microsoft sites)
-
how to implement Filter for listbox using textbox in windows application using vb.net i have a textbox and a listbox in my application listbox id binded from database.. now when the user enters anything in textbox the items which starts with the text enterd in the listbox should filter and come in the first (i mean list box is already filled in ascending order,so only the thing is the scroll should move to the starting of the word which is enterd in the textbox ) how can i achieve this? any idea?.. (same like the index search in microsoft sites)
Hi, I see basically three ways to achieve this: 1. adapt the database query as you type, using a "LIKE '+myInitialText+"%'" clause. That would be easiest. 2. adapt the items shown in some other way, maybe by copying them to a list, working on the list, and setting the new list as the new datasource 3. leaving the items as is, however simply not showing some; that takes DrawMode.OwnerDrawVariable, and returning height zero in MeasureItem for the items you want to hide. (I haven't done this yet, but I think it should work). :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.