Link to home
Create AccountLog in
Avatar of H-SC
H-SCFlag for United States of America

asked on

Conditional Formating In DataGridView

I have a datagridview that I would like the entire row to be a background of green if the column called Status = "Complete" for that particular row/record.  Thanks in advance..
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

You can use this code in the datagridview cellendedit event

If myDataGridView("Status", e.RowIndex).Value = "Complete" Then
  myDataGridView.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.Green
Else
  myDataGridView.Rows(e.RowIndex).DefaultCellStyle.BackColor = Color.White
End If

jpaulino
Avatar of H-SC

ASKER

jpaulino,

I am using tis form for display only and not allowing edits.  I have a timer attached to it to refresh.  I tried puting the code on the timer event but it does not like thr "e", any ideas??
ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of H-SC

ASKER

jpaulino,

Works great!!  Many thanks