Load data after SelectedIndexChange

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 2 years and 9 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
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Load data after SelectedIndexChange

Post by apowershelluser »

I have two CSVs I import on load
$Users - Contains UsersNames, UsersID,State
$Assets - Contains PCNumbers, Model, Serial

I have $users loaded into a combobox
Update-ComboBox -ComboBox $comboboxNames $CSV.DisplayName

On SelectedIndexChanged, is there a way I can get the UserID to query the $Assets CSV?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Load data after SelectedIndexChange

Post by jvierra »

What have you tried?

You have given no information that can help guess at any possible answer.

When loading a Combobox with objects load the whole object then when an even occurs you will know the exact object and all properties.

No idea what you mean by "query" a CSV. A CSV is a tectfile. Loaded as an object you can filter it on a property of a row.
User avatar
apowershelluser
Posts: 194
Last visit: Fri Mar 22, 2024 4:38 am
Answers: 2

Re: Load data after SelectedIndexChange

Post by apowershelluser »

When you step away and go duh
$Assets | Where-Object { $_.UserID -contains $comboboxNames.SelectedItem.Shortname }

I got it :)
This topic is 2 years and 9 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