简体   繁体   中英

vb.net textbox autocomplete , search through substring insted of first letter

hi i have long list of products. for example

 arrary('apple big size','mango 400gm',apple small size')

i want textbox suggest me names of items in array when i type in textbox. i am using right now textbox autocomplete property. code given below

        MySource.AddRange(neLst.ToArray)

        'this AutocompleteStringcollection binded to the textbox as custom
        'source.
        txtName.AutoCompleteCustomSource = MySource

        'Auto complete mode set to suggest append so that it will sugesst one
        'or more suggested completion strings it has bith ‘Suggest’ and
        '‘Append’ functionality
        txtName.AutoCompleteMode = AutoCompleteMode.SuggestAppend

        'Set to Custom source we have filled already
        txtName.AutoCompleteSource = AutoCompleteSource.CustomSource

but its search through first character i want to textbox suggest me.. through substring . in result for example

if i type 400. it will suggest me all strings which contain 400 in it

thank you in advance.

The autocomplete feature does not do a contains or substring search. You will have to do your own by catching the keyup (or similar) event and searching your list. For some help on getting starting, here is a link to someone else that has also done this. You can build from their example: http://www.codeproject.com/Articles/251110/AutoComplete-TextBox-with-substing-search-similar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM