Convert Data Row to Double

i have dt with column value and want to convert the datatype to double for calculation.
So i have used for each row
and use Assign doublevariable = Convert.ToDouble(row(“Value”).ToString)
to convert the column but have received input string was not in a correct format.

pls help

Hi @syezids

Did you check what value are you getting in the row(“Value”).ToString?
It should have some value also should not have any spaces.

Use the below code to remove spaces


Hi @syezids

Check whether is there any other special characters along the value like - symbol or a space

Can we see the value of that column if possible


maybe the value is within a local format so check which seperators are used:

Set a breakpoint within the for each row
Debug and get paused
use immediate panel and type in: row(“Value”).toString

share the output with us.

the best time would be when the bot is failing and we can inspect the failling value

Hi @syezids

Can you please share the string value and double value which you are getting after the conversion

Had this issue the other day. My input was 1.99 for example so had to use decimal for calculations instead of double. Would be more helpful if you could share values in the dt you are trying to convert though.

appreciate the fast replies my friends and have tried trimming the string and it works.
thanks everyone

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.