1
I have the following code snippet to close my application.
private void frmAgent_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("Deseja realmente fechar o sistema?", "Atenção!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
Application.Exit();
}
else
{
e.Cancel = true;
}
But when I click to close and click on sim he falls in the if, executes the excerpt Application.Exit(); and returns to the beginning of the method by opening the MessageBox again. If I click sim again, then yes he close the form. Has anyone ever seen this ?
Jay, thank you so much for your attention.
– Emerson Brito
This time it is closing the winform, but unfortunately the process is not finished when closing the application. What may be occurring ?
– Emerson Brito