How to add integer value while the comma inbetween that (Ex. 16,000)

I want to the add the value (Ex. 17,000 29,000) in the web page
So, by using the data scraping get the and store in variable(DTPlant)
And In the Message box
{DTPlant.AsEnumerable.Sum(Function(x) Convert.ToInt32(x(“Good Parts”).ToString)).ToString} (“Good parts”)>> is the Column name

If I run this I got the error as:
{Message Box: Input string was not in a correct format.}

Can u give some solution for this?

give a try on following:

Or Sumup as doubles and convert later the resulting sum to an Int32

If I Enter this Comment
{DTPlant.AsEnumerable.Sum(Function(x) Convert.ToInt32(Double.Parse(“Good Parts”).ToString)).ToString}

Its Also gave the same error

using the immediate panel we can prototype and check our statements.
Refering to the screenshots we do see, that the statement is valid.

Now we can check for the values, which are not parseable

Similar to the example, done with a list we can do it with datatables

  • set a brekapoint
  • debug and get paused
  • open immediate panel
    use the statement:
    DTPlant.AsEnumerable.Where(Function (x) Not Double.TryParse(x(“Good Parts”).toString)).toList

we will get back a list of datarows with all rows where Good Parts Values was not parseable.

Kindly note:

the reference to the looped row is missing Double.Parse("Good…

so it was parsing the string value “Good Parts” and for sure this is not a valid value

1 Like

Hi @ppr ,
Thank you so much for intimate the error.


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