i have a windwos form with a DataGridView. The data comes from a binding source. I have 2 columns with text and 2 columns with checkboxes. Before displaying I want to set checkboxes in specific rows to readonly and did the following in the dataGridView_CellFormatting
method:
dataGridView.Rows[e.RowIndex].Cells[1].ReadOnly = true;
That did not work, I still can click the checkboxes. To see which rows are relevant I also marked them with e.CellStyle.ForeColor = SystemColors.GrayText;
Even though it worked with the textbox cells. Also it is working if I would set the whole checkboxcolumn to readonly. Just not with specific cells. How can this be done? Or why are the checkboxes still not readonly?
Aucun commentaire:
Enregistrer un commentaire