Support Forums

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

MF Project

Postby 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

$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: 10947
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: MF Project

Postby 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: 204
Joined: Wed Sep 09, 2015 12:53 pm

Re: MF Project

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

Return to “PowerShell GUIs”

Who is online

Users browsing this forum: No registered users and 2 guests