title: Object reference not set to an instance of an object when changing DataGridView colors
body: <p>I need to change the colors of a data grid view rows according to the data in the rows.</p>
  
  <p>My code is:</p>
  
  <pre><code>foreach (DataGridViewRow Myrow in datagrid1.Rows)
  {            
      if (Myrow.Cells[0].Value.Equals("Red"))
      {
          Myrow.DefaultCellStyle.BackColor = Color.Red;
      }
      {
          Myrow.DefaultCellStyle.BackColor = Color.Green;
      }
  }
  </code></pre>
  
  <p>But when I try to run it I get: Object reference not set to an instance of an object</p>
  
  <p>I assume it's because it keeps looping every row until it reaches some which has a null value.
  How do I stop it from doing that?</p>