I’m trying to change the colour based on the value in the cell, complete or incomplete but for some reason it’s saying that ‘Color’ doesn’t exist in the current context.
Is there a system item I should be using or something?
If anyone has any alternatives to what I’m trying to do that would also be appreciated.
foreach (DataGridViewRow row in dtaFinished.Rows)
{
string RowType = row.Cells[4].Value.ToString();
if (RowType == "Completed")
{
row.DefaultCellStyle.BackColor = Color.Green; //Error on these lines
row.DefaultCellStyle.ForeColor = Color.White; //Error on these lines
}
else if (RowType == "Incomplete")
{
row.DefaultCellStyle.BackColor = Color.Yellow;
row.DefaultCellStyle.ForeColor = Color.Black;
}
}
use the below namespace:
using System.Drawing;hope thiS will help.