i modified my code like this:
void frmContacts_FormClosing(object sender, FormClosingEventArgs e)
{
DialogResult ConfirmareInchidereProgram = winCustomDialog.ShowBox("NU UITAȚI SĂ ADĂUGAȚI VALOZARE RAPORTULUI Z ÎN REGISTRU DE CASĂ.\n\nSunte-ți sigur că doriți să închideți aplicația?", "Închidere aplicație", "Închide aplicația", "Anulează", true);
if (ConfirmareInchidereProgram == DialogResult.No)
{
e.Cancel = true;
return;
}
else
{
SetariProgram.SoldFinal = SetariAmanet.ObtineSoldFinal();
SetariAmanet.RaportDegestiune();
FormClosing -= frmContacts_FormClosing;
}
}
and now is ok, is working.