title: looping through a data table vb
body: <p>I'm trying to loop through a data table that has multiple values for my constraint.  How can I keep the first value and add together all the other values that match my constraint.</p>
  
  <pre><code>For i = 0 To ds.Tables(0).Rows.Count - 1
  
              If ds.Tables(0).Rows(i).Item("TEND_POS_ID") = 8 Then
  
                'This only returns the last value  
                'Value 1 = 2
                'Value 2 = 7.5
                'should = 9.5 but it is showing 7.5                  
  
               tmpCoupon = ds.Tables(0).Rows(i).Item("TENDER_AMT")
              End If
          Next
          txtCoupon.Text = tmpCoupon
  </code></pre>