Is it possible to open second form?

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 6 years and 1 week 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
SvanGool
Posts: 37
Last visit: Mon Nov 27, 2023 2:02 am

Re: Is it possible to open second form?

Post by SvanGool »

This code did the trick.
Now the webbrowser is filled.

Thanks!
  1.     $f = get-item Function:\Show-ChildForm_psf
  2.     $rs = [runspacefactory]::CreateRunspace()
  3.     $rs.ApartmentState = 'STA'
  4.     $ps = [powershell]::Create()
  5.     $ps.Runspace = $rs
  6.     $rs.Open()
  7.     $ps.AddScript($f.Definition)
  8.     $ps.BeginInvoke()
This topic is 6 years and 1 week 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