MF Project

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.
Locked
User avatar
localpct
Posts: 223
Joined: Wed Sep 09, 2015 12:53 pm

MF Project

Post by localpct » Wed Apr 19, 2017 12:50 pm

So I have a project
Form # 1 checks a few things, sets some variables
Form #2 prompts the user for stuff and has an Unlock button
This unlock button validates we have access to the drive and shows form #3

This is my code for the unlock button

Code: Select all

$buttonUnlock_Click= {
#TODO: Place custom script here

#Manage-bde -unlock c: -recoverypassword $textbox3.text
if (Test-Path C:\Windows)
{
Show-MainForm_psf
}
$form2.Close()
$form2.Visible = $false
}
What I'm having issues with is closing form2 cleanly, any help?

User avatar
jvierra
Posts: 11347
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: MF Project

Post by jvierra » Wed Apr 19, 2017 1:39 pm

$form2.Close()
Don't add any code after that line.

In PowerShell you cannot "switch" forms. You can only close the currently displayed form.

User avatar
localpct
Posts: 223
Joined: Wed Sep 09, 2015 12:53 pm

Re: MF Project

Post by localpct » Thu Apr 20, 2017 8:13 am

jvierra wrote:$form2.Close()
Don't add any code after that line.

In PowerShell you cannot "switch" forms. You can only close the currently displayed form.
While that works, the form is still displayed behind, if that's the best we can do. I'm okay with this.

Locked