new window after button click

Hi Team,

As a new born baby to Powershell,i have been tasked to create GUI window using powershell, i have created a sample form and a button, say start,if i want to open a new form by clicking the start button, how to write the script.


That’s a huge topic, and one that you’ll be doing in just about the hardest possible way. Unless you’ve purchased a product such as PowerShell Studio, there’s not really an easy way to use a GUI designer and wire it up with PowerShell code; it involves a lot of manual effort to accomplish very small things.

As to how to do what you’re describing, the answer will depend on what you intend to do with that window. If it’s a modal dialog where you’ll be using the return value in some way, then you can just construct a new form and display it (probably the same way you did with the original form.) If you’re doing something like navigating between different forms, then you would probably want to construct them all in memory ahead of time, and control which one is visible via the Visible property on each one. Then your button click can just hide the original form and display the new one.