I am trying to get cells from excel in csharp, but not sure if the best type of variable is to read it.
If I make the variable a string and the cell value is double, I get a parsing error. If I make a double variable, then when the cell is a row, it will not work.
Here is the code I'm running:
try
{
string i = Globals.Sheet1.Cells[7, 7].Value;
double num;
if (i == null) return;
if (double.TryParse(i, out num))
{
.
.
.
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
source
share