Bonjour,
Dans une comboBox définit comme suit :
- DropDownStyle = DropDown
- autocompletemode = Suggest
- autocompletesource = ListItems
je voudrais que lors de la saisi dans la combo box, la recherche se fasse sur les items "contenant" la chaine saisi et nom sur les items "commençant par".
In a ComboBox declare as following :
- DropDownStyle = DropDown
- autocompletemode = Suggest
- autocompletesource = ListItems
I justr want that when I'm typing a string in the combobox, the search have to be done on the items "containing" the entered string in the combobox and not on the items "starting with" the entered string in the combobox.
Thanks
Search on comboBox
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Search on comboBox
Bonjour,
j'ai tenté de faire la recherche de cette manière /
I try to do the search on the text this way
$ComboBox.DataSource.DefaultView.RowFilter = "DisplayMember LIKE '*$($ComboBox.Text)*'"
mais cela ne fonctionne pas / but that don't work.
Is there another way the search in combobox?
Sincerly yours
j'ai tenté de faire la recherche de cette manière /
I try to do the search on the text this way
$ComboBox.DataSource.DefaultView.RowFilter = "DisplayMember LIKE '*$($ComboBox.Text)*'"
mais cela ne fonctionne pas / but that don't work.
Is there another way the search in combobox?
Sincerly yours
Re: Search on comboBox
You can try this method. It searches for s substring.
https://docs.microsoft.com/en-us/dotnet ... ew=net-5.0
https://docs.microsoft.com/en-us/dotnet ... ew=net-5.0
Re: Search on comboBox
Thanks for your help. I'm pressed by time so I workaround the problem by putting the element to be search at the begining of the item. I try your solution, and use it in future developpement.
Best regards,
Best regards,