/// <summary> /// Gets the contents of a given cell from the model and places it in the current cell contents box /// for updating /// </summary> private void SetCellContentsBox() { SpreadsheetPanel panel = window.GetSpreadsheetPanel(); // set the location of this textbox int x, y, width, height; panel.GetSelectionLocation(out x, out y, out width, out height); window.UpdateEditBoxLocation(x, y, width, height); // locate the current cell in the grid and convert to a variable panel.GetSelection(out int col, out int row); string cellName = ConvertRowColToCellName(row, col); // set the contents text to the current contents of the cell object contents = sheet.GetCellContents(cellName); if (contents is string || contents is double) { window.ContentsBoxText = contents.ToString(); } else { window.ContentsBoxText = "=" + contents.ToString(); } }