SearchBox Function

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.
This topic is 6 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
rocky.pabillore
Posts: 13
Last visit: Wed Apr 28, 2021 10:24 am

SearchBox Function

Post by rocky.pabillore »

How you grab the text or texts from a search"textbox" and use its value on another form (childform)?

For more detail, I currently have a textbox and a button, The button will show the childform. The search'textbox' is literally to show the name, portname and servername of the printer.

I just need to know how to get the value of the textbox to a childform. The help section on this website is using "Call-<name>_<ext>" but when I use it, it becomes unknown. Please help ASAP.

thank you
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: SearchBox Function

Post by jvierra »

You have to pass it as a parameter and define the parameter on the child form. This works the same as any PS script when passing parameters.

See: "HELP about_scripts" for a more detailed discussion.
User avatar
rocky.pabillore
Posts: 13
Last visit: Wed Apr 28, 2021 10:24 am

Re: SearchBox Function

Post by rocky.pabillore »

Thank you for the reply, I'm just so lost, Can you give me an example where there is a textbox with a button, and whatever the textbox has, it will be a variable on the child form?
$printers = import-csv -Path C:\temp\allprinters.csv | Where-Object { $_.name -contains "$searchtextbox_TextChanged" }
that's what I'm stuck on, and I don't know why I can't see the $searchtextbox_textchanged on my childform.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: SearchBox Function

Post by jvierra »

Because it is the event code and not the textbox. The textbox is called $searchtextbox.
This topic is 6 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked