I've create a foreach loop
in C#. I'm trying to loop trough all the rows except for the last one, which is automatically added. Since the cells contains no values I'm getting a NullException.
Important: Setting AllowUsersToAddRows to false is not an option as this function is required.
foreach (DataGridViewRow row in VRFileDataGrid.Rows)
{
Console.WriteLine(row.Cells[0].Value.ToString());
}
I'm not trying to fix met NullReferenceException
, I want to know how to perform a loop trough all rows except for the last automatically added row.