Go through and fro a collection using For Each
Hi i'm having a problem with traversing a collection using a For Each statement.
I have this variable that sums up amounts per row of every employee.when an employee changes it must display it's total on the last line of that employee then resets it for the next employee.
the problem is it displays the sum on the first line of the next employee.
the solution that i have in mind is count the no. of rows (eg. counter), when the employee changes, i will subtract 1 from the counter then write the sum(in effect,it will display the sum on the last occurence of the employee before it changes)
but i can't find the right syntax to do this.
by the way, i use DataRowView in For Each
like this.
dim dv as DataView
dim x as DataRowView
dv = dsDataSet.Tables(0).DefaultView
For Each x in dv
Next
Any help will be much appreciated, thanks! You guys rock!!