How to code incremental search

  • Thread starter Thread starter rh
  • Start date Start date
R

rh

Hi, I'd like to add an incremental search to my windows form DataGrid that
works like the one used in Windows Explorer.

In Windows Explorer, when you type a character it jumps to the first item
that matches that character. If you type another letter within a given
amount of time it will be part of the same search so that it will match the
first 2 characters and so on. If you wait long enough and then type another
character, it will treat it as a new search.

Any info, links, or sample code to help me do this would be appreciated.
Thanks in advance!
 
It may not perfect solution you are looking for but,

You can put a textbox above datagrid for search. Where user will type his
search value, as user type it will fire textchanged event. in that event you
can make corresponding rows visible and selected in datagrid.

Regards,
Rajesh Patel
 
Hi,

Take a look at the dataviews find method. Here is a sample I
wrote
http://www.onteorasoftware.com/downloads/dataviewfind.zip


http://msdn.microsoft.com/library/d...en-us/cpguide/html/cpconsearchingdataview.asp

Ken
-------------------
Hi, I'd like to add an incremental search to my windows form DataGrid that
works like the one used in Windows Explorer.

In Windows Explorer, when you type a character it jumps to the first item
that matches that character. If you type another letter within a given
amount of time it will be part of the same search so that it will match the
first 2 characters and so on. If you wait long enough and then type another
character, it will treat it as a new search.

Any info, links, or sample code to help me do this would be appreciated.
Thanks in advance!
 
You should handle OnKey(Up/Down) event.
If you'll be more specific I'll try be the same.
 
Thanks for the info. Handling the OnKey(Up/Down) seems like a good place to
start. Here are more details:

It seems that the incremental seach feature built into Windows Explorer also
has some sort of timer built into it. I would like to know how to build a
similar timer into my incremental search feature.

Also, the DataGrid I'm building will be read only and will have more then
one column. So, whatever column the user clicks and starts typing in, I
would like the search to apply to that column only. Info on how to: a)find
out which column was clicked b)perform the search on that column only and
c)highlight the matching row, would be appreciated.
 
Back
Top