Find as you type

B

benliu

I saw in an application the ability to have a user type a part of a
name in a textbox, and as they type, a datagridview shows a list of all
customers whose name contains what is typed in the textbox. This is
all done in real-time without having to require the user to press a
search button.

How would i replicate such functionality? I assume that it's querying
a database as the user types, and requerying each time they type/delete
a character in the textbox? Or it could be that the datasource is an
object collection that it's querying from?

Any ideas? Thanks!
 
J

James Daughtry

benliu said:
I saw in an application the ability to have a user type a part of a
name in a textbox, and as they type, a datagridview shows a list of all
customers whose name contains what is typed in the textbox. This is
all done in real-time without having to require the user to press a
search button.

How would i replicate such functionality? I assume that it's querying
a database as the user types, and requerying each time they type/delete
a character in the textbox? Or it could be that the datasource is an
object collection that it's querying from?

Any ideas? Thanks!

I'd say that it's probably using the TextChanged event on the TextBox
and filtering the binding source for the DataGrid with each change.
Requerying the database with each keystroke could be too performance
intensive depending on how it's done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top