Hi
I am trying to prompt the user before existing the WinForm application. Here is my FormClosing:
private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { if (XtraMessageBox.Show("Are you sure you want to exit now?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.No) { e.Cancel = true; } }
and then I am using Application.Exit in my btnExit_Click
but I am getting this error:
Collection was modified; enumeration operation may not execute
when the user clicks on btnExit
How can I solve it please..