限制Datagridview中某些列的可编辑选项 [英] restrict editable option for some columns in Datagridview
本文介绍了限制Datagridview中某些列的可编辑选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以阻止某些列在datagridview中进行编辑吗?如果是,如何?
can i block some of the columns from editing in a datagridview? if yes, How?
推荐答案
您可以将列的ReadOnly属性设置为true。
You can set the ReadOnly propperty of the column to true.
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private void Form1_Load(object sender, EventArgs e)
{
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column1});
// Column1
//
this.Column1.HeaderText = "Column1";
this.Column1.Name = "Column1";
this.Column1.ReadOnly = true;
}
这篇关于限制Datagridview中某些列的可编辑选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文