Click here to Skip to main content
15,914,820 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

Below is my code

C#
double l = Convert.ToDouble(lbll.Content);


below is the error i am getting

Input string was not in a correct format.


Please tell me the problem here
Posted

Check the value of lbll.Content, it is not a valid double. You should use Double.TryParse Method[^] instead. It returns if conversion was successful or not , passes default value to your parameter and does not throw exception.
 
Share this answer
 
The value of the lbll.Content can't converted into double.

Try a parse first as follows:
C#
double value;
if(!Double.TryParse(lbll.Content, out value))
{
    //not a double value
}

else
{
    //you can use your double value here
}
 
Share this answer
 
v3

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