I have a datagridview which will change the background color in the BackGroundColor property but when I run the app the background color looks as if it has not changed it.
How can I change the color of the DataGridView at runtime?
I have a datagridview which will change the background color in the BackGroundColor property but when I run the app the background color looks as if it has not changed it.
How can I change the color of the DataGridView at runtime?
According to the documentation, the BackgroundColor property should change the color of the DataGridView.
It is also important to remember that this property changes the default color of the space not filled by cells yet, so you could try the following code if your intention is to change the background color of a control full of data.
private void dgvStatus_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex != color.Index)
return;
e.CellStyle.BackColor = Color.FromArgb(int.Parse(((DataRowView)dgvStatus.Rows[e.RowIndex].DataBoundItem).Row[4].ToString()));
}