title: DataGridViewCell Background Color Change Without Losing Focus
body: <p>In VB .Net 3.5, is it possible to change the color of a DataGridViewCell (unbound) to a different color and <strong>have the cell visibly change before losing focus or leaving the cell</strong>? I have a timer that's running that queries with the data present and I'd like for the colors to change immediately instead of after the user leaves the cell.</p>
  
  <p>I've tried DataGridView.Refresh and Me.Refresh and don't get results.</p>
  
  <p>What am I doing wrong? (Below is the code I use to change the background) </p>
  
  <pre><code>''' &lt;summary&gt;
  ''' Sets or clears the passed cells background to Red
  ''' &lt;/summary&gt;
  ''' &lt;param name="ColumnNumber"&gt;Datagridview column index of the cell to be changed&lt;/param&gt;
  ''' &lt;param name="RowNumber"&gt;Datagridview row index of the cell to be changed&lt;/param&gt;
  ''' &lt;param name="Error"&gt;Indicate whether the cell should be red, &lt;c&gt;True&lt;/c&gt;, or empty, &lt;c&gt;False&lt;/c&gt;&lt;/param&gt;
  Private Sub Error_Cell(ByVal ColumnNumber As Integer, ByVal RowNumber As Integer, ByVal [Error] As Boolean)
      If [Error] Then
          Me.dgvMain.Rows(RowNumber).Cells(ColumnNumber).Style.BackColor = Color.Red
      Else
          Me.dgvMain.Rows(RowNumber).Cells(ColumnNumber).Style.BackColor = Color.Empty
      End If
      Me.dgvMain.Refresh()
      Me.Refresh()
  End Sub
  </code></pre>