vendredi 27 novembre 2020

C# DataGrid Cell - Change row forecolor IF

I'm trying to change the forecolor of a specific row within a datagrid if a cell within that row contains the word "WARNING".

 foreach (DataGridViewRow row in inclog.Rows)
        {
            if (inclog.SelectedCells[5].Value.ToString() == "WARNING")
            {

                inclog.SelectedRows[1].DefaultCellStyle.ForeColor = Color.Red;

            }
        }

I'm trying to change the code, add and remove bits but can't seem to be able to do it.

Aucun commentaire:

Enregistrer un commentaire