Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

2 forms - one opens the other, how to keep 1st active whilst 2nd open?

$
0
0

Hi

I have one powershell form the launches another from a button. When the 2nd form is active, the 1st one becomes unresponsive.

Searching on the net reveals info relating to the showdialogfunction:

Form.ShowDialog()|Out-Null

 

I have attempted to open the 2nd form by using a RunSpace, but this doesnt work:

$rs = [Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace()
$rs.Open()
$rs.SessionStateProxy.SetVariable("RemoteControl", $RemoteControl)
$p = $rs.CreatePipeline( { [void] $RemoteControl.ShowDialog() } )
$p.Input.Close()
$p.InvokeAsync()

(The above code is in the 2nd form)

I have a feeling Im on the right track, but I just cant get it to work....

 

Viewing all articles
Browse latest Browse all 21975

Trending Articles