/// <summary> /// Handles a request to change the contents of the selected cell. /// </summary> private void HandleCellContentsSet(string name, string newContents) { try { foreach (string cell in spreadsheet.SetContentsOfCell(name, newContents)) { object val = spreadsheet.GetCellValue(cell); string toDisplay; if (val.GetType().Equals(typeof(FormulaError))) { toDisplay = "FormErr"; } else { toDisplay = val.ToString(); } window.DisplayValue(cell, toDisplay); } } catch (CircularException e) { window.ShowCircularExceptionBox(); } catch (Formulas.FormulaFormatException e) { window.ShowFormulaExceptionBox(e.Message); } }