Call-form.psf Not Functioning

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 5 years and 10 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
kingkale
Posts: 9
Last visit: Mon Jun 18, 2018 5:34 pm

Call-form.psf Not Functioning

Post by kingkale »

Hello,

Running Windows 10 Pro, PowerShell Studio 2018 64 bit v5.5.152.0

I am trying to pass a variable from MainForm1.psf form to formPing.psf. I created both forms from File>New Form.

In MainForm1.psf, I've entered the code:
if((Call-formPing_psf -HostList $HostList -OnlineHosts $OnlineHosts) -ne 'OK')
{
Write-Host Error Calling Child Form
}
Inside formPing.psf I define my parameters as follows:
param
(
[parameter(Mandatory = $false)]
[string]$HostList,
[parameter(Mandatory = $false)]
[string]$OnlineHosts
)
As I type "Call-formPing.psf" intellesense is not showing a drop down for suggestions and the text is grey, and listed as "unknown" when I hover over it.

When I run my script, the following error pops up in the console window:

ERROR: Call-formPing_psf : The term 'Call-formPing_psf' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
ERROR: the name, or if a path was included, verify that the path is correct and try again.

I have read through multiple forum posts and this is the way you're supposed to pass variables. So why doesn't "Call" seem to function? Also, if there is another way to pass variables, such as setting a variable as global, please let me know.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Call-form.psf Not Functioning

Post by jvierra »

This: "Call-formPing_psf "

Should be this" "Show-formPing_psf "
User avatar
kingkale
Posts: 9
Last visit: Mon Jun 18, 2018 5:34 pm

Re: Call-form.psf Not Functioning

Post by kingkale »

Great, I'll try that.

I've been following this guide: https://www.sapien.com/blog/2013/10/01/ ... ing-forms/

I'm guessing this was an old guide?
User avatar
kingkale
Posts: 9
Last visit: Mon Jun 18, 2018 5:34 pm

Re: Call-form.psf Not Functioning

Post by kingkale »

It works! Thanks for your prompt reply.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Call-form.psf Not Functioning

Post by jvierra »

The call was changed in the latest versions of PSS (2117).
This topic is 5 years and 10 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