Enable Adding is false
Enable Editing is false
Enable Deleting is false
Enable Column Reordering is false
All those above settings applied I tried to see a check mark on checkboxcolumn when I click but fail, It does not appear my click actions on checkboxcolumn even I used below code.
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0)
{
dataGridView1.Columns[0].ReadOnly = false;
}
}
You cannot make only one column as readonly if datagridview on a whole is set as readonly (ie Enable editting to false )
So, firstly you need to set that to
dataGridView1.ReadOnly =false;
Next, you need to set all the columns in your code as readonly.
foreach (DataGridViewColumn dgvCol1 in dataGridView1.Columns)
{
dgvCol1.ReadOnly = true;
}
Lastly, set the required column's readonly property ( in your case the checkbox column )
to false.
dataGridView1.Columns("ColumnName").ReadOnly = false;
I hope this solution is useful for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.