title: Read cell in each row of datagridview in C#
body: <p>I am currently developing an application in C# where I need to read the values of the cell of each row in a DataGridView in C#. </p>
  
  <pre><code>        foreach (DataGridViewRow row in tblCategories.Rows)
          {
              string folderPath = tblBackups.Rows[row].Cells[5].Value.ToString();
              string backupIncludes = tblBackups.Rows[row].Cells[4].Value.ToString();
              Console.WriteLine("Folder Path: " + folderPath);
              Console.WriteLine("Backup Includes: " + backupIncludes);
          }
  </code></pre>
  
  <p>For some reason, this is not working.</p>