Page 1 of 1

MF Project

Posted: Wed Apr 19, 2017 12:50 pm
by localpct
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
  1. $buttonUnlock_Click= {
  2.     #TODO: Place custom script here
  3.    
  4.     #Manage-bde -unlock c: -recoverypassword $textbox3.text
  5.     if (Test-Path C:\Windows)
  6.     {
  7.         Show-MainForm_psf
  8.     }
  9.     $form2.Close()
  10.     $form2.Visible = $false
  11. }
What I'm having issues with is closing form2 cleanly, any help?

Re: MF Project

Posted: Wed Apr 19, 2017 1:39 pm
by jvierra
$form2.Close()
Don't add any code after that line.

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

Re: MF Project

Posted: Thu Apr 20, 2017 8:13 am
by localpct
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.