[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


0 Comments   [ + ] Show comments

Answers (1)

Posted by: william.hsia@dss.ca.gov 7 years ago
White Belt
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.
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ