By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Q: DataRowView

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Nov 20 '05 #2

P: n/a
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

"Geoff Jones" <ge***@NODAMNSPAM.com> wrote in message
news:40***********************@news.dial.pipex.com ...
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

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.