How can I get a C # textbox autocomplete to make suggestions based on additions rather than starting with?
I have a textbox in my C # Windows Forms application that has AutoCompleteMode set to AutoCompleteMode.Suggest and my content source is a custom source.
My content source is customizable with the following values:
- Jim smith
- Alice Walker
- Bob walker
- Jeremy Smith
Only content completion is performed, checking to see if the suggested items will "start with" the value in the text box.
For example:
text=J
As a result, suggestions will appear:
- Jim smith
- Jeremy Smith
However, if the user enters
text=Walk
No results.
How can I get content completion to suggest the following?
- Alice Walker
- Bob walker
Also, my end goal is to have a text box where people can start typing email addresses easily. The content of the autocomplete suggestions will include names + email addresses. For example:
- Jim Smith <jsmith@mycorp.com> - Alice Walker <alice@some.email.com> - Bob Walker <bob.walker@mycorp.com> - Jeremy Smith <jeremys@foo.com>
This is not possible in an inline text box.
Reading the reference source reveals that the autocomplete function calls the native SHAutoComplete function to do this. It only does prefix matching.
You will need to subclass the TextBox and provide your own prompt (or buy it / find an open source file) to do this.