Q: DataRowView

  • Thread starter Thread starter Geoff Jones
  • Start date Start date
G

Geoff Jones

Hi

Suppose I have a loop such as:

For Each x As DataRowView In dataViewObj
' Some calculations go here
Next

Suppose we to access within the loop not only the current row but the next
one e.g. during the first loop x will be the first row, how can I access the
second row as well?

Thanks in advance

Geoff
 
Hi Geoff,

For me you are repeating your question about the for each loop with an index
to the datarow, in my opinion the answer is the same, because of the fact
that the dv only references the datarow and the dataview.

So here as well is an for index loop needed when you want to reach your
goal.

What is it that you have against that nice for index loop?

Cor
 
Geoff,
In addition to the other comments:

I would use a regular For loop:

Dim dataViewObj As DataView

For index As Integer = 0 To dataViewObj.Count - 2
Dim x As DataRowView = dataViewObj(index)
Dim x1 As DataRowView = dataViewObj(index + 1)
' Some calculations go here
Next

I use Count - 2 as the last record will not have a next record.

Hope this helps
Jay
 
Back
Top