I'm trying to make the user be asked to confirm the exit from my program in C #, but for some reason, if they say yes, they would like to exit, the confirmation window will appear again. I canβt understand why.
if (MessageBox.Show("Are you sure you want to exit?", "Confirm exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { e.Cancel = true; } else { Application.Exit(); }
c # winforms exit confirm
Sean
source share