Messagebox after Close (x)

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 5 years and 6 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
PanklIT
Posts: 4
Last visit: Wed Aug 02, 2023 3:34 am

Messagebox after Close (x)

Post by PanklIT »

Hi there,

quick question - i think its quick - but i was not able to find a proper answear.

I do have a form project and everytime when i close the form with the Close Icon (x) (not a close button, just the red windows x in the upper right corner :-) ) i get an messagebox with "Cancel" and an "OK" button:

Image

How can i suppress this message?

Thanks, Raphael
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: Messagebox after Close (x)

Post by Alexander Riedel »

Search for "Cancel" in your script. Is it somewhere in there?
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
PanklIT
Posts: 4
Last visit: Wed Aug 02, 2023 3:34 am

Re: Messagebox after Close (x)

Post by PanklIT »

No nothing - just one but that is used in an if statement.

Strange thing - i have a check in my startup.pss if a module is installed - and when the module is not installed a messagebox is displayed and when i close this message box with the (X) i get "OK":

Image
User avatar
PanklIT
Posts: 4
Last visit: Wed Aug 02, 2023 3:34 am

Re: Messagebox after Close (x)

Post by PanklIT »

Ok, it also happens with a Quit Button with "$MyForm.close()" - strange ..
User avatar
PanklIT
Posts: 4
Last visit: Wed Aug 02, 2023 3:34 am

Re: Messagebox after Close (x)

Post by PanklIT »

Nevermind i, might, have found the solution:

In the startup.pss i called the MainForm only with "Show-MainForm_psf" - i checked the templates and i changed that to:

Code: Select all

		if ((Show-MainForm_psf) -eq 'OK')
		{
			
		}
Now its working :)
This topic is 5 years and 6 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