I am all about questions today, dont know why!
I am wondering, when the user clicks on the red X button to close the application, the form closing event is raised.
I am wondering if there is a way to prevent the application from being closed when the user presses the cross button?
When my application is doing something and during this process the user wants to close the app - a dialog box tells the user that the application is currently doing a process and asks if they still wanna exit - if the answer is no then I want the application to still be up and running and not exit when the answer is "no"
Currently I've set the e.Cancel = false, which works but then the application form appears to be disposed/closed but i dont want this
Code:DialogResult confirmExit = MessageBox.Show("It appears that there is a recording in progress, are you sure you wish to exit the application?", "Confirm exit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (confirmExit == DialogResult.No) { e.Cancel = false; } else {//Whatever....}




Reply With Quote