0

I want to iterate through the rows of a certain column in my datatable and add the contents of these rows to calculate yhe sum. However I only want the sum of SOME rows NOT just all of the rows. I am using the code below to show me the value of the last row in that particular column however now I want to iterate through MORE rows and calculate the totals(For this one particular column) how can I do this?

 For Each mytablerow As DataRow In myTable.Rows()
     RadTextBox8.Text = mytablerow.Item("PercentageInMix")
 Next
madth3
  • 7,275
  • 12
  • 50
  • 74
Tendai Mare
  • 31
  • 1
  • 2
  • 14

1 Answers1

0

I got it all I needed was just one line of code

        RadTextBox8.Text = myTable.Compute("SUM(PercentageInMix)", " [Include] =1      AND    ProductCode = '" & txtProductCode.Text & "'   ").ToString
        BindingContext(myTable).EndCurrentEdit()
Tendai Mare
  • 31
  • 1
  • 2
  • 14