Author Posts

April 3, 2015 at 2:44 am

Struggling to find a starting point on how to capture a combobox change event.

All i'm looking to do is update combobox2, from the selection of combobox1 dropdown list. I.e. Select Accountant in combobox1 dropdown list, combobox2 automatically updates with OU Accounts.

Could anyone give me a starting point on how this should look?

Thanks

April 4, 2015 at 4:41 am

https://msdn.microsoft.com/en-us/library/system.windows.forms.listbox_events(v=vs.110).aspx covers the docs for the control; there's a change* event. You bind it the same way you'd bing the Click event for a button. I'm not sure if you're using PowerShell Studio; if you are, you should be able to right-click the control in the designer and add the code for the change event.

*Specifically, SelectedIndexChange or SelectedValueChange are probably what you want, depending on how the control's behavior is configured.

April 6, 2015 at 7:15 am

$combobox1_SelectedIndexChanged = { write-host $combobox1.Text}