Today's techno world, people are making everyday silly mistack with coding.
Here I am trying to cover one simple error message "Input string was not in correct format".
Base on above error message experience developer know where he/she had make a mistack but I am writing this blog for newbie of Asp.Net, C# developer.
when you try to convert any empty string, double value etc into integer value. that time getting above message.
Lets check example.
Here I am trying to cover one simple error message "Input string was not in correct format".
Base on above error message experience developer know where he/she had make a mistack but I am writing this blog for newbie of Asp.Net, C# developer.
when you try to convert any empty string, double value etc into integer value. that time getting above message.
Lets check example.
var intValue1 = Convert.ToInt32("-52.066666"); // error
var intValue2 = Convert.ToInt32("52.066666"); // error
var intValue3 = Int32.Parse("52.066666"); // error
var intValue4 = Int32.Parse("52"); // Correct
var intValue1 = Convert.ToInt32("-52"); // Correct
Hope you getting basic idea for string conversion issue.