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.
Locked
User avatar
rocky.pabillore
Posts: 13
Joined: Thu Aug 25, 2016 7:05 am

SearchBox Function

Post by rocky.pabillore » Mon Apr 24, 2017 1:34 pm

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

User avatar
jvierra
Posts: 13620
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: SearchBox Function

Post by jvierra » Mon Apr 24, 2017 2:00 pm

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
Joined: Thu Aug 25, 2016 7:05 am

Re: SearchBox Function

Post by rocky.pabillore » Tue Apr 25, 2017 7:50 am

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.

User avatar
jvierra
Posts: 13620
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: SearchBox Function

Post by jvierra » Tue Apr 25, 2017 10:07 am

Because it is the event code and not the textbox. The textbox is called $searchtextbox.

Locked