I need the Form GUI to automatically load one of two lists into combobox2 when a Choice is made in combobox1.
I have read about selectedindexchanged but I cannot seem to automate that without a refresh button.
Anyone have a working example of how to achieve this.
Thanks
Does anyone have a working example of selectedindexchanged (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: Does anyone have a working example of selectedindexchanged (combobox)
Thank you, I came across that one before not exactly what I was looking for or maybe I am missing something, but thanks for the headsup.
My combobox1 is "ListOfNumbers","ListOfLetters"
My combobox2 is either list "1","2","3" or "A","B","C".
When user chooses ListOfNumbers from dropdown a list of Choices "1,2,3" show up in combox2.
and when ListOfLetters is chosen, the dropdown lists Choices "A,B,C"
I have gotten that to work with an refresh button and an if statement. But I cannot seem to figure out how to update automatically.
That is where my knowledge comes up short.
My combobox1 is "ListOfNumbers","ListOfLetters"
My combobox2 is either list "1","2","3" or "A","B","C".
When user chooses ListOfNumbers from dropdown a list of Choices "1,2,3" show up in combox2.
and when ListOfLetters is chosen, the dropdown lists Choices "A,B,C"
I have gotten that to work with an refresh button and an if statement. But I cannot seem to figure out how to update automatically.
That is where my knowledge comes up short.
Re: Does anyone have a working example of selectedindexchanged (combobox)
What does "update automatically" mean?
The "SelectedIndexChanged" event is where you would reset the second ComboBox items.
The "SelectedIndexChanged" event is where you would reset the second ComboBox items.
Code: Select all
$comboBox1SelectedIndexChanged = {
$items = if($this.Text -eq 'ListOfLetters){@('A','B','C')}else{){@('1','2','3')}
$comboBox2.Items.Clear()
$comboBox2.Items.AddRange($items)
}
Re: Does anyone have a working example of selectedindexchanged (combobox)
Here is a full working example of how to synchronize lists.
- Attachments
-
- FunWithLists.psf
- (27.8 KiB) Downloaded 227 times
Re: Does anyone have a working example of selectedindexchanged (combobox)
I attempted the proposed code and I get
ERROR: The property 'SelectedIndexChanged' cannot be found on this object. (which is reasonable since it does not exist)
ERROR: The property 'SelectedIndexChanged' cannot be found on this object. (which is reasonable since it does not exist)
Re: Does anyone have a working example of selectedindexchanged (combobox)
I did used the proposed Method and adapted it to my needs (that is what I meant with code).
The proposed method starts off with "comboBox1.SelectedIndexChanged" which is a none existing property.
The proposed method starts off with "comboBox1.SelectedIndexChanged" which is a none existing property.
Re: Does anyone have a working example of selectedindexchanged (combobox)
$ComboBox
You must use the variable whatever you named it. By default PSS names the first ComboBox variable $combobox1 and increments the number for each box. You have to use the variable that was created. It may be 1,2,3 or other depending on the number and order of the boxes you added in the designer.
To learn about how to use this control go here: https://info.sapien.com/index.php/guis/ ... ox-control
You must use the variable whatever you named it. By default PSS names the first ComboBox variable $combobox1 and increments the number for each box. You have to use the variable that was created. It may be 1,2,3 or other depending on the number and order of the boxes you added in the designer.
To learn about how to use this control go here: https://info.sapien.com/index.php/guis/ ... ox-control