Textbox Selected Item to String?

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.
Post Reply
mwilliamsocc
Posts: 11
Last visit: Fri Oct 18, 2024 4:31 pm
Has voted: 1 time

Textbox Selected Item to String?

Post by mwilliamsocc »

I know I have done this plenty of times before but I cannot get it to work today.

I have a textbox that I populate with items from Active Directory. I want the selected item to show up in another (single line) text box.

I attempted something like the following:
  1.    
  2. $selectedGRP = $txtbGrpUsers.SelectedText
  3.     $StringText = $selectedGRP.ToString()
  4.     $textbox2.Text = $StringText
But this does not work for me... Code complete doesnt even like "selectedtext" which is what I found when doing google searches searching for help on this. I know this is super rudimentary and apologize for bugging the collective with it.

Thanks for your help!
Post Reply