Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i had click the cancel button of form but application window is close, but the application is running in background because the pause button is not disable. so how to close the application in background.

What I have tried:

i just use the Application.Exit() button in that. it is working but when i use the default cancel form button it is not working. application is running in background.
Posted
Updated 29-Mar-18 2:07am

Closing the main form will/should cause the app to close. In the Cancel button event handler in your form, do this:
C#
this.Close();


Or, you can set this.DialogResult to false. This will cause the form to close.

Either way, if you're also handling the Close event, make sure your code is processing according to which button was used to close the form.
 
Share this answer
 
v4
in event of form closed just write
application.exit()

it will work properly....
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900