Windows Phone Developers

Friday, May 7, 2010

Input string was not in a correct format. - Csharp/VB.NET WriteLine Function

If you are using VB.NET/C# Writeline function and facing the following error, it has to do with formatting


Wrong :
double Sal = 1250.45;
        Console.WriteLine("Salary before hike is {0:D}", Sal); //Decimal instead of double
        Console.WriteLine("Salary before hike is {F}", Sal); //Index is missing
            

Correct:
double Sal = 1250.45;
        
Console.WriteLine("Salary before hike is {0:F}", Sal);


USe appropriate composite format string - decimal , double Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment