I have a searchbox that queries a database and shows the results in a box below. This is kinda slow when I use the ontextchanged event, cause the database gets queried each time a new letter is written.
How can I make it only do the query when the user is done writing, or each time the user takes a small break?
The easiest way is to record the time that the last OnTextChanged occured. And if the current time greater than N, then call the web service.
Another way, is to start a repeating time for every N milliseconds and then check the Text with the lastText and if not equal call the web service. If you do this, use System.Windows.Form.Timer so that your callback is executing on the UI when you get the current Text from the search box.