Hello,
I have windows form with combobox and listbox.
I want that once item selected in the combobox, the items in the listbox will change accordingly
tried million of options but nothing is working.
can someone please help?
thanks,
Sarit
ComboBox and ListBox trigger
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: ComboBox and ListBox trigger
Just load your listbox in the event.
I have no idea what you are trying to accomplish as you question is very vague:
Here are many examples of how to use a combobox. Perhaps I twill help. https://www.google.com/?gws_rd=ssl#neww ... n+combobox
I have no idea what you are trying to accomplish as you question is very vague:
Here are many examples of how to use a combobox. Perhaps I twill help. https://www.google.com/?gws_rd=ssl#neww ... n+combobox
Re: ComboBox and ListBox trigger
The following is about the simplest example that I can come up with.
- Attachments
-
- Demo-SimpleComboRelation.psf
- (21 KiB) Downloaded 210 times
Re: ComboBox and ListBox trigger
$combobox2_SelectedIndexChanged={
#TODO: Place custom script here
param (
[string]$DisplayMember_CB_LDST = ["LDST-TGB-BES01", "LDST-TGB-BES02"],
[string]$DisplayMember_CB_MAST = ["MAST-TGA-BES01", "MAST-TGA-BES02"]
)
if ($combobox1.SelectedIndex -eq "Staging")
{
if ($combobox2.SelectedIndex -eq "UK")
{
Load-ListBox -ListBox $listBox1 -Items $DisplayMember_CB_LDST
}
else
{
if ($combobox1.Items -eq "Staging")
{
if ($combobox2.Items -eq "Latam")
{
$checkedlistbox1.SelectedIndex = $DisplayMember_CB_MAST
}
}
}
}
}
this is my code.. im a beginner in PS so I guess im missing something
#TODO: Place custom script here
param (
[string]$DisplayMember_CB_LDST = ["LDST-TGB-BES01", "LDST-TGB-BES02"],
[string]$DisplayMember_CB_MAST = ["MAST-TGA-BES01", "MAST-TGA-BES02"]
)
if ($combobox1.SelectedIndex -eq "Staging")
{
if ($combobox2.SelectedIndex -eq "UK")
{
Load-ListBox -ListBox $listBox1 -Items $DisplayMember_CB_LDST
}
else
{
if ($combobox1.Items -eq "Staging")
{
if ($combobox2.Items -eq "Latam")
{
$checkedlistbox1.SelectedIndex = $DisplayMember_CB_MAST
}
}
}
}
}
this is my code.. im a beginner in PS so I guess im missing something
Re: ComboBox and ListBox trigger
Sorry but your code does not make any sense to me. I recommend leaningPowerSHell before attempting to use forms. YOu APara statement is syntactically impossible and is throwing errors. Look up the help on each of these items and read the details.
I am sorry but a forum is not the right place to teach PowerShell. Search for books and sites teaching PowerSHell.
Here is one place to start: https://mva.microsoft.com/en-us/trainin ... 2304984382
I am sorry but a forum is not the right place to teach PowerShell. Search for books and sites teaching PowerSHell.
Here is one place to start: https://mva.microsoft.com/en-us/trainin ... 2304984382