private static float ReturnFloat(Cell cell) { float variable = 0F; if (cell is IntCell) { IntCell numCell = (IntCell)cell as IntCell; variable = (float)numCell.value; } if (cell is FloatCell) { FloatCell numCell = (FloatCell)cell as FloatCell; variable = (float)numCell.value; } return(variable); }
public static Cell GetCell(int vertical, int horizontal, StringBuilder enter) { IntCell intCell = new IntCell(vertical, horizontal, enter); if (intCell.value != null) { return(intCell); } else { FloatCell floatCell = new FloatCell(vertical, horizontal, enter); if (floatCell.value != null) { return(floatCell); } else { string s = "#Cannot convert to numeric"; return(new ErrorCell(vertical, horizontal, enter, s)); } } }