Search code examples
c#winformsrdlcstring-parsing

Opening RDLC Report in ReportViewer in C# cause <datatype>.Parse() methods to thrown 'Input string was not in a correct format' Exception


I am writing an accountant software containing windows forms. I have a lot of forms and a lot of code so it is absolutely useless to share a snippet of it because it cannot show anything of the program logic.

My problem here is that I have created an RDLC report for printing invoices and I have put it in a ReportViewer control. It works fine. But after I open the form containing the ReportViewer and go back to other forms the Parsing methods start failing no matter the value.

For example:

decimal.Parse("0.00");

will cause 'Input string was not in a correct format' Exception. This problem doesn't occur unless I open the Report. Please help! Thank you all in advance!


Solution

  • You need to separate your floating part with , instead of .

    decimal.Parse("0,00");
    

    Will work