Hello i have simple problem
If no values in datagrid need to repair my code
Error is:
System.NullReferenceException: 'Object reference not set to an instance of an object.' System.Windows.Forms.DataGridViewCell.Value.get returned null.
My code
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");
}
}
}