Highlighting DataGridView Row
<p>I want to highlight DataGridView rows depending on value. If value is validated then green if not then red.<br/>
I get the green and red when cell has not been formatted before. However when I go back to the green row and change its value which is not validated one cell does not change to red. It stays green.<br/>
See the pictures:<br/>
1)Without any entry<br/>
<a href="https://i.stack.imgur.com/ukPjN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ukPjN.png" alt="enter image description here"></a><br/>
2)Entered Validated value<br/>
<a href="https://i.stack.imgur.com/Gu908.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gu908.png" alt="enter image description here"></a><br/>
3)Went back and entered wrong value<br/>
<a href="https://i.stack.imgur.com/9FItn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9FItn.png" alt="enter image description here"></a><br/>
As you can see only first cell is red, but I want whole row to be red.
<br/>I am formatting cells in CellValidating event. Here's the code:<br/></p>

<pre><code>Private Sub dgvItems_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) Handles dgvItems.CellValidating
    If e.ColumnIndex = ValueColumnIndex Then
        If Not ValidateValue(e.FormattedValue) Then
            Me.dgvItems.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.LightPink
            Me.dgvItems.DefaultCellStyle.SelectionBackColor = Color.LightPink
            Me.dgvItems.DefaultCellStyle.SelectionForeColor = Color.Black
            e.Cancel = True
        Else
            Me.dgvItems.DefaultCellStyle.SelectionBackColor = SystemColors.Highlight
            Me.dgvItems.DefaultCellStyle.SelectionForeColor = SystemColors.HighlightText
            Me.dgvItems.Rows(rowIndex).DefaultCellStyle.BackColor = Color.LightGreen
            Me.dgvItems.Rows(rowIndex).DefaultCellStyle.ForeColor = Color.Black
        End If
    End If
End Sub
</code></pre>

<p>Any help appreciated. Thanks. </p>