DataGridView read only cells

前端 未结 9 430
余生分开走
余生分开走 2020-12-09 10:57

I have a binded DataGridView that contains a large amount of data. The problem is that some cells has to be ReadOnly and also when the user navigates with TAB or ENTER betwe

9条回答
  •  醉梦人生
    2020-12-09 11:29

    Try to make the column rather than individual cells readonly before binding the data:

    this.dgrid.Columns["colName"].ReadOnly = true;
    

    If you need to do for individual cells within the column, then you will have to loop and set them like this:

    this.dgridvwMain.Rows[index].Cells["colName"].ReadOnly = true;
    

提交回复
热议问题