Close Main Form When Child Form Opens

Ask your PowerShell-related questions, including questions on cmdlet development!
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 11 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
A. Hohl
Posts: 18
Last visit: Thu Aug 01, 2019 3:13 am

Close Main Form When Child Form Opens

Post by A. Hohl »

Hello,

I am trying to figure out how to close the main form or hide it when the child form opens, I am using my main form as a user agreement and when they click accept I have it opening the child form but I would like for the user agreement to close so it is not in the way. I thought if I told it told it to close when the I agree button was clicked that, that would work but it did not. Any help?

$MainForm_Load={
#TODO: Place custom script here
}

$buttonIAgree_Click = {
$MainForm.Close()
if ((Show-ChildForm_psf) -eq 'OK')
{

}
}
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Close Main Form When Child Form Opens

Post by jvierra »

You can't. A parent cannot be hidden when it has a visible child.
This topic is 6 years and 11 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