I'm writing a program that at one point implements a TextBox
with autocomplete. Currently, for purpose of simplicity I'm using CustomSource
manually populated by several entries at design time. While autocomplete works fine, I'd like it to make suggestions that don't simply start with the currently entered text, but contain it at any position in the stored choices.
For example, if words "globe", "lobe", and "glide" are the stored options, typing in "gl" correctly suggests both "globe" and "glide".
However, I'd like it to suggest both "globe" and "lobe" when "lob" is typed in. I'm not exactly sure how to approach this.
Has anyone done this before? VB.NET or C# are both fine, as long as I can figure out a proper .NET way to do this.
Cheers! = )
So i was looking for something like this. A TextBox with AutoComplete with a Contains search instead of a StartsWith.
This rendition is from this WinForms | C# | AutoComplete in the Middle of a Textbox?
I was able to make this, here is my version of an autocomplete that uses Contains. I hope everyone finds this usable.
the list you are search in try use the condition to get in list or not
if you connect to a database use in you query
Regards
UPDATE
after you comment
The best option I see would be to create your own implementation of IAutoComplete. Here is info on it: http://msdn.microsoft.com/en-us/library/bb776292%28VS.85%29.aspx
Also you can do some searches for some code samples of people creating their own IAutoComplete implementations.
Regards