Thursday, April 21, 2011

Asynchronous autocomplete in winforms

Is there a way to get asynchronous auto-complete in a Winforms TextBox or ComboBox? AJAX is so nice, and I would be amazed if the .NET framework doesn't have a thick client equivalent.

From stackoverflow
  • There's no such feature out of the box, but it shouldn't be too hard to implement it yourself... Handle the TextChanged event, send a request asynchronously to get the matching items, and change the AutoCompleteSource when you get the result. You just need to be careful to access UI components on the UI thread, using the Invoke method (or you can use a BackgroundWorker and access the UI in the RunWorkerCompleted event)

    tster : wow, seems like such an oversight.
  • I know that in MFC you can use SHAutoComplete and the shell will do it for you. However I'm not sure the best way to do this in WinForms, but it should be possible.

    See this question and this one for some more info.

0 comments:

Post a Comment