How to Negative Value using TryParse

Dear Experts,

We need to allow negative values for Adjustments, how can we do this using TryParse?


Thanks.
JimiJ13I T ConsultantAsked:
Who is Participating?
 
käµfm³d 👽Commented:
Well you didn't say which kind of type you are dealing with, but the short answer to your question is yes.

e.g.

int iValue;
string strValue = "-10";

int.TryParse(strValue, out ivalue);

decimal dValue;
strValue = "-10.99";

decimal.TryParse(strValue, out dValue);

Open in new window

0
 
JimiJ13I T ConsultantAuthor Commented:
Thanks for the quick response.  There was an error because I missed something else.
0
 
JimiJ13I T ConsultantAuthor Commented:
Thanks for the quick answer.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.