For each row in datatable: check if currentrow and next two rows from currentrow is empty

Hi, how to check if currentrow and next two rows from currentrow are empty? I know how to check for currentrow but I don’t know how to check for the next two row

Hi @arina

By using currentrow index+1 and index+2 like that you can check it empty or not

Regards,
Kaviyarasu N

Hi,

Hope thew following helps you.

dt.AsEnumerable.Skip(idx).Take(3).All(Function(r) String.IsNullOrEmpty(r("ColumnName").ToString))

OR

String.IsNullOrEmpty(CurrentRow("ColumnName").ToString) AndAlso (idx+1>=dt.Rows.Count OrElse String.IsNullOrEmpty(dt.Rows(idx+1)("ColumnName").ToString)) AndAlso  (idx+2>=dt.Rows.Count OrElse String.IsNullOrEmpty(dt.Rows(idx+2)("ColumnName").ToString))

Regards,

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