on-internet
← Community

Cannot change colour of DataGridView or set to ReadOnly

Stack Overflow ·

I have a datagridview where i need to disable rows where the checkbox value on that row isn't checked, here's the code: foreach (DataGridViewRow row in catView.Rows) { if (row.Cells[1].FormattedValue.ToString() != "true") { for (int i = 0; i < row.Cells.Count; i++) { row.Cells[i].Style.ForeColor = Color.Gray; row.Cells[i].ReadOnly = true; } } } Problem is that this doesn't set the colour or disable the checkbox, what am i getting wrong? More info: cells[1] is the checkbox column.

Comments

Sign in or sign up to comment and upvote.

No comments yet.