In VB .Net 3.5, is it possible to change the color of a DataGridViewCell (unbound) to a different color and have the cell visibly change before losing focus or leaving the cell? 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.
I've tried DataGridView.Refresh and Me.Refresh and don't get results.
What am I doing wrong? (Below is the code I use to change the background)
''' <summary>
''' Sets or clears the passed cells background to Red
''' </summary>
''' <param name="ColumnNumber">Datagridview column index of the cell to be changed</param>
''' <param name="RowNumber">Datagridview row index of the cell to be changed</param>
''' <param name="Error">Indicate whether the cell should be red, <c>True</c>, or empty, <c>False</c></param>
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