Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to auto filter the combobox list items automatically if anywhere the text is matches in the list items using c# in winforms.


i.e

If the user enter "Jonne" in the combobox, suggestions list must filter as follows.

Jonne Mathew
Kent Jonne
Thoms Robert Jonne
Thoms Jonne

I am using the following code

What I have tried:

C#
comboBoxDealerSearch.DataSource = dt;
comboBoxDealerSearch.DisplayMember = "Dealer_Name";
comboBoxDealerSearch.ValueMember = "Id";
comboBoxDealerSearch.AutoCompleteMode = 
AutoCompleteMode.SuggestAppend;
comboBoxDealerSearch.AutoCompleteSource = 
AutoCompleteSource.ListItems;
Posted
Updated 15-Jul-23 13:59pm
Comments
Member 15627495 15-Jul-23 15:19pm    
there are methods to sort your comboBox,
but know that you can sort the dataContainer invovled before you fill the combobox.

you have : ComboBox / datatable ( or in-middle ) / and SQl query : all those can sort your result before the display

1 solution

Here is a CodeProject article (Tip) that does what you want: ComboBox with Suggest Ability based on Substring-Search[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900