private void buttonReadyClick(object sender, EventArgs e) { toCloseTheForm = true; checkFieldsAndAddOrEditInTheDB(); if (toCloseTheForm) { this.Close(); } }