Jay,
In addition to using an indexed For loop. You can simply increment a
counter
with a For Each.
For index As Integer = 0 to ds.Tables(0).Rows.Count - 1
Dim row As DataRow = ds.Tables(0).Rows(index)
...
Next
or
Dim index As Integer = 0
For Each row As DataRow In ds.Tables(0).Rows
...
index += 1
Next
Either works, performance may vary based on the specific collection. I
normally use the second as it seems cleaner.
So you see how personal preference can be different, for me is that with the
first.
(Maybe because I am with the second never sure that there is not used a kind
of dictionary index, what does in the first case not matter, I hope this
describes what I want to say with that. I don't believe that that is done
here by the way)
That leads me to use consequently to use the first when I need an index. Can
be a crazy feeling by the way.
Cor