Page 1 of 1

Application exits when $frmName.Hide() is called

Posted: Thu Aug 29, 2013 11:10 am
by josh.perkins
When I minimize my form using the following Resize event, my form closes (exits, PowerShell Studio debug stops). Any help would be appreciated.
PowerShell Code
Double-click the code block to select all.
$frmMainUI_Resize={
	if ($frmMainUI.WindowState -eq 'Minimized') {
		$frmMainUI.Hide()
	}
}

Re: Application exits when $frmName.Hide() is called

Posted: Thu Aug 29, 2013 11:32 am
by jvierra
That is correct.

In PowerShell we can only launch a form as a Modal Dialog. When a dialog is hidden it is also terminated with a dialogResult of "Cancel".

Hide is the same as Close using the escape key.

Re: Application exits when $frmName.Hide() is called

Posted: Thu Aug 29, 2013 11:40 am
by josh.perkins
Great, thank you for the quick reply.