Best way to search db with WebSearchField

I have a WebSearchField that I want to use for searching in an online Mysql db.

Is it best to perform the search directly from the TextChanged event, or is it better to have a button with the action to perform the search based on text entered in the WebSearchField?

My question is if using Textchanged directly to search will send multiple db requests for every charact entered in the WebSearchField?

I would prefer the button solution, because of the performance.

TextChanged will fire for every character. So if you place your db code in there, it will make as many queries as there are characters.

Either use a button, or use a timer with 500 ms period that you reset in the TextChanged event :

Timer1.Mode = Timer.ModeOff Timer1.Mode = Timer.Mode Single

In the timer Action event, place the query. Each time you type a character the timer is pushed up so it does not fire. If no character has been typed for half a second, then the query happens. That is the way Mac search fields work.

A timer works, but the events of the keypress go to the server for handling (nothing happens on the users end). Because of this latency I tend to use a button to initiate the search.

Thanks guys. My initial thought was to go with the button.