Decimal.TryParse(String s, ByRef result as decimal) is not returning decimal value

Hi all,

I am using Decimal.TryParse() for checking whether an string is an decimal or not. If it is an decimal, then convert the value to decimal & then stored it into a variable of type decimal.

This method is able to check for decimal but it is not returning any value. Refer below code:

String strAmount = 10.00;
Decimal decAmount;
Boolean isAmount;

isAmount = Decimal.TryParse(strAmount , decAmount);

Write line → isAmount.ToString
Write line → decAmount.ToString

isAmount is true but decAmount is 0.

1 Like

Hi dear,

use this way please using tow assign activity:

isAmount = Decimal.TryParse(strAmount , decAmount);
decAmount = if(isAmount,CDec(strAmount),0)