You can use the
Style[
^] property of
DataGridViewCell
class. Here is a quick example:
theDataGridView.Rows[i].Cells[j].Style.BackColor = System.Drawing.Color.Red;
[UPDATE - after OP comment]
If you need to change the color of cell, dynamically, based on its value you can use
DataGridView.CellFormatting Event[
^] (the answer from
Hiren contains a link to similar approach). The example from the documentation page shows how to change the background color of a cell, based on the string entered in it. It should not be a problem to use similar approach in your case. If there are some problems, please let me know.
[/UPDATE]