0
votes

I would like to change the color of a particular row in my datagridview after my row Chckbox is in selected mode:

private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
    bool isSelect = dataGridView1[0, e.RowIndex].Value as bool? ?? false;
    if (isSelect)
    {
        // Change row color
    }
}
1

1 Answers

2
votes
if (isSelect)
{
    // Change row color
    var row = this.dataGridView1.Rows[e.RowIndex]
    row.DefaultCellStyle.BackColor = Color.Red;
}