For each Row: How to get the value of next row value (Current Row +1 )

Hello all,

I have doubt in which while using for each row , I would like to get value of current row As well as current row + 1
Example:
The image shows an Excel spreadsheet with a column labeled "Material" and a list of material codes starting from MI00030 to MI00037. (Captioned by AI)

I would like to get Row(“Material”) = MI00030 and next row value = MI00031 as well reading the current row in the for each

@Yugal_Raju

You can use the index property in for each activity and assign a variable now in your code use dt.Rows(indexvar+1)("AnyColumn") to get the next row

Make sure when the index value is one less than the count of rows you should not do the indexvar+1 as the number of rows are reached there wont be any next row

For your case dt.Rows(indexvar+1)("Material").ToString indexvar to be assigned to index property in for loop…

Cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.