How to set keyboard focus to a TextBox in Powershell

Question:

I’m looking to find out how to automatically set the keyboard focus to a text box in powershell.

I have a script that asks the user to select an option from a dropdown menu, then based on that selection, they have to input certain parameters. That all works fine.

For ease of use, I’d like the focus of the keyboard to shift to the input box each time a new one is shown, so the user doesn’t have to keep clicking on it to enter some text.

My code so far :

Any ideas?

Thanks!

Answer:

Following your code, where I can find a dropdown menu, to give focus to textbox when form is shown I’ve done:

Source:

How to set keyboard focus to a TextBox in Powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply