I have a datagridview with a column called "status" that loads a value from a database, i'm trying to change the back color of the row to yellow if there's the value of "cleaned" in the 'status' column.
I'll put the function in my form load event, whats the best way of doing this?

2 answers
This should work:
answered one year ago by:
17279
Thanks vulpes - although i think i may have something set up wrong, i cant get that code to work correct, and as i'm sure your code is fine it must be the way i'm executing it, i can get it to change only the first row yellow if i adapt it as follows:
answered one year ago by:
690
17279
Yes, I tried the code and it worked fine. Are you sure you're placing the code AFTER the code which binds the DGV to your database table in Form_Load?
690
I've inserted it below the code in my edited answer? just one other thing, i have to apply the column name like so [2] otherwise it throws an error saying column name not found?
17279
The problem appears to be that you're inserting the code after the datatable has been filled but before it's been bound to the DGV which is therefore empty at the time. You should have a line like this somewhere: dataGridView1.DataSource = this.usedDataSet.used; and the new code needs inserting after that.
690
My datagridview is created by visual studio from the toolbar dragged onto the form, would that make a difference?
690
Ahh -yes vulpes i got it working, it was a typo on the data in the field :) thanks for your help.