Do while or while loop condition

Dear Forum member

I have created a Data table with two column and after creating the data table i am adding a column “Status” with default value “No”.
Inside dowhile loop i am assigning the cell value and changing the “status” column value to “Yes” for each row and increasing the rowindex value for iteration.
I am using the loop condition dt1.Rows(rowindex)(2).ToString=“No”

It’s going good but at last it’s giving a error “There is no row at position 3.”

How to solve this error, i can only use while or do while loop.


Can you share your condition in do while?

Hi @Yankit_singh

Use for each loop and inside the loop use assign like row(2) = “yes”

Thankx for reply

I am using dt1.Rows(rowindex)(2).ToString=“No” in condition.

No condition should be like below in while
dt1.rows.count > rowIndex

Thankx for response

As i mentioned i can only use while or do while loop