Night Walker
Night Walker

Reputation: 21260

Iterating through DataGridViewRow columns

How can I iterate through DataGridViewRow columns? I just want to get the number of columns that I have and go through them and get the values.

Upvotes: 0

Views: 1569

Answers (1)

Haris Hasan
Haris Hasan

Reputation: 30097

You can use Cells property to get all values row have

foreach(DataGridViewCell cell in row.Cells)
{
    get value by    cell.Value
}

and number of columns is equal to number of cells

Upvotes: 4

Related Questions