hi,
i would like to change the row color in a data grid view at runtime.
i made this code but it didn't work
foreach (DataGridViewRow dgvr in dgvReservations.Rows)
{
string status = dgvr.Cells[10].Value.ToString() ;
if (status == "Canceled")
{
dgvr.DefaultCellStyle.BackColor = Color.Red;
}
}
not even this worked
for(int i = 0; i<dgvReservations.RowCount; i++)
{
string status = dgvReservations.Rows[i].Cells[10].Value.ToString();
if (status == "Canceled")
{
dgvReservations.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.Red;
}
}