[Admin Script Editor] Create multiple Forms for the same script PS
Hi All,
I'm working on PowerShell GUI based-script using Admin Script Editor and i have a question about creating a multiple forms for the same script (same PS project)
When i launch ScriptForm Designer, there is only one form named "Form1" and if i try to perform the action bellow, a new project is created ! :
File > New > PowerShell -> Native Windows Form
A new project "Untitled" is created
I want to create multiple form on the same project because my GUI PowerShell program will have multiple button that will open other winforms ...
Thanks in advance for your help.
i'll appreciate
Rgds,
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
william.hsia@dss.ca.gov
8 years ago
The only way I've been able to add additional forms is to code the object creation by hand. In the form creation section just add this line
$Form2 = New-Object System.Windows.Forms.Form
or whatever variable name you want, just as long as it's different from the original form. Save it, then open the scriptform designer and you'll see your extra forms.
My recommendation is to edit the form in a separate project with unique design names then when it looks good just copy and paste the code over.
$Form2 = New-Object System.Windows.Forms.Form
or whatever variable name you want, just as long as it's different from the original form. Save it, then open the scriptform designer and you'll see your extra forms.
My recommendation is to edit the form in a separate project with unique design names then when it looks good just copy and paste the code over.