Combobobox SelectedIndexChanged does not work correct

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
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.
This topic is 5 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
derhoeppi
Posts: 34
Last visit: Mon Nov 28, 2022 8:48 am

Combobobox SelectedIndexChanged does not work correct

Post by derhoeppi »

I'm using a combox as droptdown element to show the user some possible values. The user is able to write a new value into the combobox. One action of the combobox is to trigger something after the index of the selected combobox has changed. My problem is, that the event is triggered if i change the index with may preassigned value. But if the user type in a new value the event does not be triggered. With a separate button i check the combobox index.
How is it possible to trigger also an event if a new value was inserted?
User avatar
derhoeppi
Posts: 34
Last visit: Mon Nov 28, 2022 8:48 am

Re: Combobobox SelectedIndexChanged does not work correct

Post by derhoeppi »

Okay i find out that i have to use the TextUpdate event. Is it possible to insert a delay for that action, so i have a change to type in more than one character?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Combobobox SelectedIndexChanged does not work correct

Post by jvierra »

The ComboBox is not designed to do what you are trying to do. You can use the key events to capture each character and take custom actions or just use the CB as designed and use the tab key to accept the input.

Here is one way to do what you are trying to do. (see attachment)
Attachments
Test-CBAppend2.psf
(46.21 KiB) Downloaded 112 times
This topic is 5 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked