$Form.Close()

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.
This topic is 6 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
michael.farber@mlp.com
Posts: 2
Last visit: Thu May 14, 2020 11:08 am

$Form.Close()

Post by michael.farber@mlp.com »

I have a form that reads the xml file into the dropdown box.
So far working as expected.

The plan is to gather some info and then run it in winpe before the MDT build.

So only issue so far is i have a $Form.Close() at the end of the script and that is generating an error:
ERROR: You cannot call a method on a null-valued expression.
ComboBOx-XML.psf (87, 3): ERROR: At Line: 87 char: 3
ERROR: + $Form.Close()
ERROR: + ~~~~~~~~~~~~~
ERROR: + CategoryInfo : InvalidOperation: (:) [], RuntimeException
ERROR: + FullyQualifiedErrorId : InvokeMethodOnNull
ERROR:

What am i missing?
Thank you.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: $Form.Close()

Post by jvierra »

Sorry but there is not enough information to understand your question.
User avatar
petrosphere
Posts: 1
Last visit: Sat Apr 11, 2020 7:04 pm

Re: $Form.Close()

Post by petrosphere »

You need to add this to your script:
  1. function OnApplicationExit {
  2.    
  3.     $script:ExitCode = 0 #Set the exit code for the Packager
  4. }
I generally add it right after the OnApplicationLoad function.
This topic is 6 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked