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.
Locked
User avatar
JohnTitor
Posts: 163
Last visit: Tue Jul 27, 2021 5:57 am

Load data after SelectedIndexChange

Post by JohnTitor »

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: 14872
Last visit: Tue Jul 27, 2021 9:44 am
Answers: 12
Has voted: 3 times
Been upvoted: 10 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
JohnTitor
Posts: 163
Last visit: Tue Jul 27, 2021 5:57 am

Re: Load data after SelectedIndexChange

Post by JohnTitor »

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

I got it :)

Locked