i am doing a simple conversion from decimal to string and stripping trailing zeros like so:
argCat.ToString(“0.##”)
however, i keep getting the following error:
Conversion from string “0.##” to type ‘Integer’ is not valid.
am i missing something?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This would happen if
argCatis of a type that does not have aToString()overload that accepts a parameter.In such a case, your code is parsed as
ToString()("0.##"); the"0.##"becomes an argument to the indexer in theStringreturned byToString().You then get this misleading error because that indexer takes an int, not a string.