Dec 3, 2015

Asp.net - Input string was not in a correct format.

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.
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.

2 comments:

  1. I get a lot of great information from this blog. Thanks for sharing this valuable information to our vision. You have posted
    a trust worthy blog keep sharing.
    mobile repairing course in hyderabad

    ReplyDelete


  2. I am extremely impressed with your writing skills and also with the layout on your blog
    mobile repairing course in hyderabad

    ReplyDelete