private void MessageCrudView_FormClosing(object sender, FormClosingEventArgs e) { DialogResultData <AppMessage> data = MV.Data; AppMessage result = data.Results; DialogResult dialog = data.DialogResult; if (dialog == DialogResult.OK && result != null) { Data.Results = result; Data.DialogResult = dialog; MV.CleanUp(); } else if (dialog == DialogResult.None) { e.Cancel = true; } else { e.Cancel = false; Data.DialogResult = dialog; MV.CleanUp(); } }