title: Check if datagridview cell is null or empty
body: <p>I have to change the background color of the cells , when their value is string or empty, this is the code i have write similar to other codes here :</p>
  
  <pre><code>for (int rowIndex = 0; rowIndex &lt; dataGridView1.RowCount; rowIndex++)
              {
               string conte = dataGridView1.Rows[rowIndex].Cells[7].Value.ToString()  ;
                  if (string.IsNullOrEmpty(conte))
                  {
                  // dataGridView1.Rows[rowIndex].Cells[7].Style.BackColor = Color.Orange;
                  }
                  else
                   { dataGridView1.Rows[rowIndex].Cells[7].Style.BackColor = Color.Orange; }
          } 
  </code></pre>
  
  <p>the dataset is complete , show me the datagridview populated and the show me this error: <img src="https://i.stack.imgur.com/ecwKd.png" alt="enter image description here"></p>
  
  <p>How can i fix this?? Have another way to write the code?</p>