locked
Searching a ComboBox RRS feed

  • Question

  • I've built a Powershell GUI to query AD. I have a dropdown (Test) which you can select from - this will then populate another dropdown (Objects) to show the objects listed under an OU container.

    I then have a textbox which i want to type in to search the 2nd dropdown (Objects) - so if i have 10 objects (test1, test2, test10, test15, test20, test30, test40 etc)  if i type "test1" it will only show test1, test10, test15

    I did think about ......

    $UsernameTextBox.Add_TextChanged(

    {

    #check $ObjectsComboBox and show filter result

    #THIS IS THE BIT IM UNSURE ON!

    }

    )

    Is there an easy way to do this or would i need a datagrid to filter the result

    Thanks in advance. Hoping some can help


    • Edited by LloydyJ89 Friday, June 7, 2019 2:31 PM
    Friday, June 7, 2019 11:27 AM

All replies

  • What do you mean by "search"?  Are you asking how to "filter" a listbox?


    \_(ツ)_/

    Friday, June 7, 2019 9:36 PM
  • Yes. If i have 20-30 accounts i do not want to look down the whole combobox list

    What i would like is to type in the textbox and filter the result. 

    Monday, June 10, 2019 8:30 AM
  • You have to create a filtered copy of the items or use a DataTable for the source which then uses "RowFilter" to select what is displayed.  There is not "Filter" for a combobox.


    \_(ツ)_/

    Monday, June 10, 2019 11:12 AM