I've got a datatable and I want to loop through and edit the value of a single cell in each row. How do I go about doing that? I've tried the following, but it hasn't worked:
Any thoughts?Code:Dim i, j, iSum As Integer For i = 0 To dt.Rows.Count - 1 dt.Rows(i).BeginEdit() If i = 0 Then dt.Rows(i).Item(6) = CInt(dt.Rows(i).Item(5)).ToString Else For j = 0 To i iSum += CInt(dt.Rows(i).Item(5)) Next dt.Rows(i).Item(6) = iSum.ToString End If dt.Rows(i).EndEdit() dt.Rows(i).AcceptChanges() Next dt.AcceptChanges()




Reply With Quote