Howdy Folks,

I'm working on a program that does a bit of color-coding in a datagridview. My problem is that when a row is selected, the color-coding goes away since the normal behavior for the datagridview is to change the back-color to blue and fore-color to white. What I want it to do though is keep the fore-color that is being set through my code. I guess what I'm trying to find out is if there is an event that happens when a row is selected that I can modify to run my own color-coding. I posted a link below to an image of my program that should help illustrate what I'm talking about. My color-coding code is below that (if anyone would want to know what that looks like).

Any help would be greatly appreciated, if it gets solved I'll be sure to post the code solution!

For i As Integer = 0 To Me.dgvOne.Rows.Count - 1
            If Me.dgvOne.Rows(i).Cells("SCHFINISH").Value < CDate(Now) Then
                Me.dgvOne.Rows(i).Cells("SCHFINISH").Style.ForeColor = Color.Red
                Me.dgvOne.Rows(i).DefaultCellStyle.BackColor = Color.Salmon
            End If

            If Me.dgvOne.Rows(i).Cells("ACTHOURS").Value > Me.dgvOne.Rows(i).Cells("ESTHOURS").Value Then
                Me.dgvOne.Rows(i).Cells("ACTHOURS").Style.ForeColor = Color.Red
                Me.dgvOne.Rows(i).DefaultCellStyle.BackColor = Color.Salmon
            End If

            If Me.dgvOne.Rows(i).Cells("ACTCOST").Value > Me.dgvOne.Rows(i).Cells("ESTCOST").Value Then
                Me.dgvOne.Rows(i).Cells("ACTCOST").Style.ForeColor = Color.Red
                Me.dgvOne.Rows(i).DefaultCellStyle.BackColor = Color.Salmon
            End If



I think you can find some explanation here.

for clarity and simplicity, just use the white-smoke background colour.
this gives your datagridview a white and ash color for each row. its standard