George Laing

George Laing

  • NA
  • 35
  • 0

Grid Cell Color

Jan 6 2009 12:05 PM

Hi,

  I use the following method to change a grid cell value to red, I want to be able to change it back to black when a button is clicked. I tried using a if statement but received a message that color cannot be converted to bool. Can someone show me how to ask if a grid value is a certain color

   

private void Grid_Cust_HPR_CellEndEdit(object sender, DataGridViewCellEventArgs e)

{

if (Grid_Cust_HPR.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.ForeColor = Color.Black)

{

Grid_Cust_HPR.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.ForeColor = Color.Red;

but_Cust_UD.Enabled = true;

}

}

 


Answers (2)