Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I try add to double type List element:

C#
CurrentValues.Add(double.Parse(name.InnerText)); //15.9933

But i get error:

{"Input string was invalid."}
What format name.InnerText must be?
Thank you
Posted
Comments
CHill60 25-Apr-13 11:10am    
name.InnerText must be a string containing numeric characters. What is actually in name.InnerText

Just try the other way around to see what the result is:
String.Format("{0}", 15.9933)


Good luck!
 
Share this answer
 
Depends - the chances are that the InnerText property contains some wrapper information (possibly HTML but without knowing what control it is I can't tell) - so use the Text property instead!
 
Share this answer
 
Assuming that CurrentValues are something like
C#
List<double> CurrentValues = new List<double></double></double>


You could have a decimal place wrong, so you could use invariant culture insead:
C#
double.Parse(name.InnerText, CultureInfo.InvariantCulture)


You should also check to see if InnerText is not empty.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900