how do I programmatically close a 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.
User avatar
Posts: 5
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Sun Mar 03, 2013 12:42 pm

how do I programmatically close a form?

Post 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.

User avatar
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: how do I programmatically close a form?

Post 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.
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.

SAPIEN Technologies, Inc.