Click here to Skip to main content
15,039,149 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can i block some of the columns from editing in a datagridview? if yes, How?

1 solution

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[] {
            // Column1
            this.Column1.HeaderText = "Column1";
            this.Column1.Name = "Column1";
            this.Column1.ReadOnly = true;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900