Hi all,
What's the best way to see if an item already exists in a Combobox before adding it? I've tried
foreach ($obj in $Combobox.Items)
as well as $Combobox.FindString
Both don't seem to work. This may be simple but there's not much information on Google on how to do it.
Thanks!
Check if an item in a combobox already exists
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.
-
- Posts: 4
- Last visit: Fri Jan 03, 2020 12:41 am
Re: Check if an item in a combobox already exists
Code: Select all
if($conbobox.Items | Where-Object( $_ -eq 'myitem'}){
# found
}else{
# not found
}