I’m trying to change color of empty rows in a DataGridView
foreach (DataGridViewRow r in dgv1.Rows)
if (r.Value.ToString() == "")
//if (r.Cells.Value.ToString() == "") - also trying
r.DefaultCellStyle.BackColor = Color.WhiteSmoke;
but Row has no definiton for Value, and Cells need to be specified by Column.
How can I do this, please ?
Well, you’ll need to check all the
Cells. Here’s how you can do that using LINQ: