kwilliams Posted October 25, 2006 Share Posted October 25, 2006 I have a site that uses the FormatCurrency method in ASP.NET 1.1 in the following way:strTax = FormatCurrency(strTax)We just installed ASP.NET 2.0 on this server, and I now receive the following error message:Exception Details: System.FormatException: Input string was not in a correct format.Source Error:Line 323: strTax = Left(strTax, Len(strTax) - 6) & "," & Right(strTax, 6)Line 324: End IfLine 325: strTax = FormatCurrency(strTax) '<<---Problem codeLine 326: 'Format special taxLine 327: If Len(strSpec_tax) > 2 Then So if anyone can help me to change my code so that the FormatCurrency method is used in the proper way for ASP.NET 2.0, that would be great. Thanks for any help. Link to comment Share on other sites More sharing options...
kwilliams Posted October 25, 2006 Author Share Posted October 25, 2006 I've solved the problem by adding the following if statement around the problem code:If strTax <> 0 Then If Len(strTax) > 2 Then strTax = Left(strTax, Len(strTax) - 2) & "." & Right(strTax, 2) End If If Len(strTax) > 6 Then strTax = Left(strTax, Len(strTax) - 6) & "," & Right(strTax, 6) End IfEnd IfstrTax = FormatCurrency(strTax)The original code couldn't handle a zero value, so this solved the problem. Thanks anyway. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now