We help IT Professionals succeed at work.

How to Negative Value using TryParse

JimiJ13
JimiJ13 asked
on
Dear Experts,

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


Thanks.
Comment
Watch Question

Most Valuable Expert 2011
Top Expert 2015
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

JimiJ13I T Consultant

Author

Commented:
Thanks for the quick response.  There was an error because I missed something else.
JimiJ13I T Consultant

Author

Commented:
Thanks for the quick answer.