/// <summary> /// Handles a request to close the window /// </summary> private void HandleClose() { if (spreadsheet.Changed) { if (MessageBox.Show("File isn't saved. Would you like to save the file before closing? ", "Save file", MessageBoxButtons.YesNo) == DialogResult.Yes) { spreadsheetView.Save(); spreadsheetView.CloseWindow(); } else { spreadsheetView.CloseWindow(); } } else { spreadsheetView.CloseWindow(); } }