Sketchs.Add(new SKETCH(SketchWorkSheet.Cells[i, 3].ToString(),
SketchWorkSheet.Cells[i, 4].ToString(),
SketchWorkSheet.Cells[i, 5].ToString(),
SketchWorkSheet.Cells[i, 6].ToString(),
SketchWorkSheet.Cells[i, 7].ToString(),
SketchWorkSheet.Cells[i, 8].ToString(), Convert.ToDouble(SketchWorkSheet.Cells[i,9])));
when i run this i get an error as
Input string was not in a correct format
Can any one help me in this

AlanRank #669 · 3.6K reputationPosted Dec 17, 2007, 7:52 AM EST
Given that particular error meesage, I'm fairly sure that this expression is the problem:
Convert.ToDouble(SketchWorkSheet.Cells[i,9])
The most likely explanation is that Cells[i,9] is either empty or contains nothing but spaces which would cause Convert.ToDouble to fail.
If that's the case and you'd be happy to pass zero in that situation, you could use:
double d;
double.TryParse(SketchWorkSheet.Cells[i,9], out d);
and then pass 'd' as the final parameter to the SKETCH constructor.
ramya naidu12 reputationPosted Dec 17, 2007, 6:08 PM EST
Thanks for u help i will try it
ramya naidu12 reputationPosted Dec 17, 2007, 7:54 PM EST
Hai its not taking any value and its showing false value i need to write data from excel cells to generic list using c#
I have made the attempt to do that but iam not able to read the values plz help me in this
AlanRank #669 · 3.6K reputationPosted Dec 19, 2007, 6:18 AM EST
double.TryParse() will return false if what's in the Excel cell cannot be parsed as a floating point number but, in this event, the variable 'd' will be zero i.e. an exception will not be thrown.
Are you saying that a value of zero is not acceptable as the last parameter of the SKETCH constructor? If so, is there some default value that could be used instead?