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.
Locked
User avatar
PanklIT
Posts: 4
Joined: Tue Jan 23, 2018 1:29 am

Messagebox after Close (x)

Post by PanklIT » Tue Sep 25, 2018 11:35 pm

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: 6834
Joined: Tue May 29, 2007 4:43 pm

Re: Messagebox after Close (x)

Post by Alexander Riedel » Tue Sep 25, 2018 11:48 pm

Search for "Cancel" in your script. Is it somewhere in there?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
PanklIT
Posts: 4
Joined: Tue Jan 23, 2018 1:29 am

Re: Messagebox after Close (x)

Post by PanklIT » Wed Sep 26, 2018 12:10 am

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
Joined: Tue Jan 23, 2018 1:29 am

Re: Messagebox after Close (x)

Post by PanklIT » Wed Sep 26, 2018 12:26 am

Ok, it also happens with a Quit Button with "$MyForm.close()" - strange ..

User avatar
PanklIT
Posts: 4
Joined: Tue Jan 23, 2018 1:29 am

Re: Messagebox after Close (x)

Post by PanklIT » Wed Sep 26, 2018 12:34 am

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 :)

Locked