Since you have used Index+1 it in the last row it will check for the row which is not available in your datatable.
Let me say, you have 10 rows in your datatable. Inside the loop at 10th row you are looking the data in the 11th row which is not exists in the datatabel.
You can avoid this using, IF Activity inside the loop, To check whether it is the last row or now with “yourDataTable.Rows.IndexOf(row) <> yourDataTable.Rows.Count”
But I would like to know what you are trying to do by checking the next row value in the current looping mechanism you have.
It’s a capture of a text file but i treat the data on a data table of course.
That’s a second eg :
U2 E1 1000 270616LXIBORDLIV
U2 E1 V2706A2000
U2 E1 V2706A4000AD010
U2 E1 V2706A4000AD030
U2 E1 V2706A4000DA320
U2 E1 V2706A4000TA400
U2 E1 V2706A3002
U2 E1 5 00010004
So, my job is to check differents samples in each bloc. I have to check the type of the bloc “DLIV” for both. After, the ID “41087” for the the first bloc.
I have an input excel file with two column : Type and ID. For eg : DLIV for the type and 41087 for the ID. I have to remove the bloc which match with the Id and type. Then, here my development :
For each row which contain 41087, add to collection and remove it. For each row(“Colum3”) which contain DLIV and that the next row(“Colum3”) contain 41087, add to collection and remove it and to finish for each row(“Colum3”) which contain "5 " and that the last row(“Colum3”) contain 41087, add to collection and remove it.
I expect that i clear. Don’t hesitate to tell me if you want more.
I assume that those two blocks are text files, if is matches with “DLIV” and “41087” and where we need to delete it, from the Input excel or from the text file.
I need to check the next row because i have to remove the row before the bloc (bloc = the several row which have 41087) then i try to remove the line which contain “1000” and where the next row contain 41087.