System.NullReferenceException: 'Object reference not set to an instance of an object.' System.Windows.Forms.DataGridViewCell.Value.get returned null.
private void ListDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { foreach (DataGridViewRow row in ListDataGridView.Rows) { if (String.IsNullOrWhiteSpace(row.Cells["R.b."].Value.ToString())) { row.DefaultCellStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml("#51B3E8"); } else { row.DefaultCellStyle.ForeColor = System.Drawing.ColorTranslator.FromHtml("#09ECA6"); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)