Sum data in dataTable

hello, please help me with next problem.
I have a Datatable
For examle
id(Int), isActive(Boolean), value1 (int), value 2 (int),…,valuen (int), summ
i have all values except summ,
how to calculate summ for each user (all value fields)?

I tried this way

  1. for each row activity
  2. row.ItemArray.ToList
  3. Then I though than can take only integer values
    listObjectValues.FindAll(Function § p is Integer).ToList(of Integer)
    (It doesn’t work)
  4. and then call sum function on my list of Integers, because on this step i should sum all integers in each row.

But I failed on step3, please help me filter and convert list of objects to list of Integers

If there is more elegant solution for this task, i also be very happy.

Refer these links How to sum the data in the row and put the sum in another excel

1 Like