title: How to change row color in datagridview online after change cell value C#?
body: <p>How can I change the row color in datagridview when type the cell value , I used the following code and cellFormatting event but its give error input string was not in a correct format when enter the value between lower limit and upper limit</p>
  <pre><code>private void dgvResult_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
          {
  
              if (dgvResult.Rows[e.RowIndex].Cells[&quot;Result&quot;].Value == DBNull.Value)
              {
                  e.CellStyle.BackColor = Color.LightSkyBlue;
              }
  
              else if (Convert.ToInt32(dgvResult.Rows[e.RowIndex].Cells[&quot;Result&quot;].Value.ToString()) &gt;= Convert.ToInt32(dgvResult.Rows[e.RowIndex].Cells[&quot;Lower Limit&quot;].Value.ToString()) &amp;&amp;
              Convert.ToInt32(dgvResult.Rows[e.RowIndex].Cells[&quot;Result&quot;].Value.ToString()) &lt;= Convert.ToInt32(dgvResult.Rows[e.RowIndex].Cells[&quot;Upper Limit&quot;].Value.ToString()))
              {
                  e.CellStyle.BackColor = Color.LightSkyBlue;
              }
  
              else if (Convert.ToInt32(dgvResult.Rows[e.RowIndex].Cells[&quot;Result&quot;].Value) &lt; Convert.ToInt32(dgvResult.Rows[e.RowIndex].Cells[&quot;Lower Limit&quot;].Value) ||
                  Convert.ToInt32(dgvResult.Rows[e.RowIndex].Cells[&quot;Result&quot;].Value) &gt; Convert.ToInt32(dgvResult.Rows[e.RowIndex].Cells[&quot;Upper Limit&quot;].Value))
              {
                  e.CellStyle.BackColor = Color.LightSalmon;
              }
          }
  </code></pre>
  <p>Is this CellFormatting is the correct event or there is another event I can use to solve this issue  and change the row color after type the result value and compare it with lower and upper value ?</p>