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 2 years and 4 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.
Hi I am working on a GUI script that opens a pop up when "Later" button on the GUI is clicked. The pop up has "Yes" and "No" buttons and the message says if you want to complete the form later. If yes is clicked the form closes but when no is clicked, I want the pop up close and the form to stay open. My script is as below:
"User $($env:USERNAME.Text) deferred filling out form $($env:COMPUTERNAME) Date: $dt"|Out-File-FilePath"$($Global:REPO)$($env:USERNAME.Text)-$($env:COMPUTERNAME)-$dt.deferred"-force
$formAssetForm.Close()
}
'No'{
## Do something
$formAssetForm.visible =$true
}
}
}
With this script, when I click on No, the form still closes. Can someone please help what am I doing wrong here?
You have to follow all of the instructions in my reply. The code is not the problem. First learn basic PowerShell then spend some time learning WinForms. Guessing will just waste your time. The button is likely set to return a dialog result.
Remeber we can't see your sreen or yuour code and we cannot help you if you do not know the basics or you can't give accurate explanations of what you are doing.
This topic is 2 years and 4 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.