Page 1 of 1

how do I programmatically close a form?

Posted: Fri Apr 05, 2013 11:57 am
by rkirchhof
I've just learned how to open one with call-MyForm_pff, but how do I close it when I'm finished with it? me.close() aint it.

Re: how do I programmatically close a form?

Posted: Fri Apr 05, 2013 12:09 pm
by davidc
Inside the form script you need to use the form variable in order to close it:
PowerShell Code
Double-click the code block to select all.
$form1.Close()
PowerShell doesn't support classes and thus "me" or "this" doesn't work. They normally reference the instance of the class.

The only time you can use $this to determine the caller of an event block.

David