Hi
Is there a way to filter the result in the combobox to match what you type like this
tried a textchanged event on the combobox but when you type in it get invertet the input?
$TextChanged = $cars | Where-Object { $_.TemplateName -like "*$($combobox1.Text)*" }
Update-ComboBox $combobox1 $TextChanged -DisplayMember "TemplateName"
so how do i filter the result in the combobox - so when i type ex "ford" it should only show ford in the dropdown?
combobox filtering/autocomplete input
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.
combobox filtering/autocomplete input
- Attachments
-
- cars.psf
- (22.94 KiB) Downloaded 259 times
-
- ford.PNG (10.33 KiB) Viewed 2910 times
Re: combobox filtering/autocomplete input
Set the "AutoCompleteMode" filter on the properties tab. It is under "Misc" at the bottom:
https://docs.microsoft.com/en-us/dotnet ... mework-4.8
https://docs.microsoft.com/en-us/dotnet ... mework-4.8
Re: combobox filtering/autocomplete input
doesnt do anything?
$form1_Load={
Update-ComboBox $combobox1 $cars
$combobox1.AutoCompleteMode = 'SuggestAppend'
}
should it not suggest when i typing : Fo
The function im looking for is something like this
When i type "on" in the box it should limited the list to
Gordon Murray
Honda
Aston Martin
Proton
$cars | Where-Object {$_ -like "*on*"}
Can it be done? with textchanged event
$form1_Load={
Update-ComboBox $combobox1 $cars
$combobox1.AutoCompleteMode = 'SuggestAppend'
}
should it not suggest when i typing : Fo
The function im looking for is something like this
When i type "on" in the box it should limited the list to
Gordon Murray
Honda
Aston Martin
Proton
$cars | Where-Object {$_ -like "*on*"}
Can it be done? with textchanged event
Re: combobox filtering/autocomplete input
It works for me but you haven't set the source for the autocomplete. Read the docs on using autocomplete. It has a complete example.
AutoCompleteSource = 'ListItems'
AutoCompleteSource = 'ListItems'
Re: combobox filtering/autocomplete input
it works now - but this method req that you know the begining of the word you looking for.
$form1_Load={
Update-ComboBox $combobox1 $cars
$combobox1.AutoCompleteMode = 'SuggestAppend'
$combobox1.AutoCompleteSource = 'ListItems'
}
if i was looking for these item in the list
"Bentley TEST"
"Mini TEST"
"Volvo TEST"
by typing "tes" i would not get the result wanted but it will suggest "Tesla Motors"
So somehow i need a filteret result in the dropdown when typing in the box.
$form1_Load={
Update-ComboBox $combobox1 $cars
$combobox1.AutoCompleteMode = 'SuggestAppend'
$combobox1.AutoCompleteSource = 'ListItems'
}
if i was looking for these item in the list
"Bentley TEST"
"Mini TEST"
"Volvo TEST"
by typing "tes" i would not get the result wanted but it will suggest "Tesla Motors"
So somehow i need a filteret result in the dropdown when typing in the box.
Re: combobox filtering/autocomplete input
There is really no way to do that with a ComboBox. You would have to create a custom control set with a textbox and a ListBox that are data bound and use the DefaultDataView "RowFilter" to filter the list.