Add second form to a Non-Multiform Project

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
JDruhan
Posts: 10
Last visit: Thu Nov 23, 2017 8:00 am

Add second form to a Non-Multiform Project

Post by JDruhan »

I started out my project thinking I'd only need the one form. Now I've decided to add a popup form.

I've added a new form file to the project (.psf) but I don't know how to call that form from within the main form. It seems the Call-FormName_Extension command does not work when the project is not a "Multiform Project".

I think I need to tell the Startup.pss file to include the new form and then use a command to show it from within MainForm but I'm not sure how.

User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 1 time

Re: Add second form to a Non-Multiform Project

Post by davidc »

To comply with PowerShell best practices, we changed the Call verb to Show.

So it should now be:

Show-FormName_Extension

Refer to this article for more details:

https://www.sapien.com/blog/2016/11/15/ ... -v5-3-130/
David
SAPIEN Technologies, Inc.

User avatar
JDruhan
Posts: 10
Last visit: Thu Nov 23, 2017 8:00 am

Re: Add second form to a Non-Multiform Project

Post by JDruhan »

Thanks! That fixed me up.

Locked