Error while converting string into double and assigning it into double variable

I have two string values. I convert each one into double and subtract it as Convert.ToDouble(TeamTimeEntry)-Convert.ToDouble(BillHrs). and store it into a double variable Hrs using assign activity. But I am getting error as :
Assign: Input string was not in a correct format.

Please anyone provide solution to me

Hi,

Can you share specific content of TeamTimeEntry and BillHrs?

Regards,

1 Like

TeamTimeEntry = ā€œ121.6ā€ and BillHrs = ā€œ6.7ā€

Hi @rifnanahas

Can you remove double quotes and check the value

Thanks
Ashwin S

1 Like

Hi,

It might be cultureinfo matter. Can you try the following expressions? Only one of them will work, probably.

Convert.ToDouble(TeamTimeEntry, New System.Globalization.CultureInfo("en-US"))-Convert.ToDouble(BillHrs, New System.Globalization.CultureInfo("en-US"))

Convert.ToDouble(TeamTimeEntry, New System.Globalization.CultureInfo("fr-FR"))-Convert.ToDouble(BillHrs, New System.Globalization.CultureInfo("fr-FR"))

Regards,

1 Like

I just wrote it as an example. I use a for each row activity of data table db. Access the data as
TeamTimeEntry= data.item(0).ToString and BillHrs= data.item(1).toString.

Now need to convert into double and subtract it and assign result to a double variable

I tried the Same Code ā€¦ was able to get the Output.

One thing you can try :

Convert.ToDouble(TeamTimeEntry.ToString)-Convert.ToDouble(BillHrs.ToString)

Also , Please verify The Output variable Datatype Correctly set to Double

ā€“
Mukesh

1 Like

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