C# DataGridView指定列可编辑
一、设置DataGridView可编辑
//列表可编辑,除选择列外不可编辑(在view_CellBeginEdit事件指定) this.view.ReadOnly = false;
二、处理DataGridView的
private void view_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { DataGridView dgv = (DataGridView)sender; //判断是否可以编辑 if (dgv.Columns[e.ColumnIndex].Name != "select") { //编辑不能 e.Cancel = true; } }
有些事情,没经历过不知道原理,没失败过不明白奥妙,没痛苦过不了解真谛。临渊羡鱼,不如退而结网!

浙公网安备 33010602011771号