title: How to make datagrid columns editable
body: <p>I want to make 2 of columns in DataGrid editable. I tried changing readonly to false, but that didn't help.</p>
  
  <p>So can anyone tell me any other way that I can try or is this something which is not letting it be editable.</p>
  
  <p>Thanks</p>
  
  <p>I went to DataDridView Task and on that particular column I changed ReadOnly 'false'. But this didnt help.
  And yes it is a WinForm.</p>
  
  <pre><code>namespace Payroll
  {
      partial class AttendanceLog
      {
          /// &lt;summary&gt;
          /// Required designer variable.
          /// &lt;/summary&gt;
          private System.ComponentModel.IContainer components = null;
  
          /// &lt;summary&gt;
          /// Clean up any resources being used.
          /// &lt;/summary&gt;
          /// &lt;param name="disposing"&gt;true if managed resources should be disposed; otherwise, false.&lt;/param&gt;
          protected override void Dispose(bool disposing)
          {
              if (disposing &amp;&amp; (components != null))
              {
                  components.Dispose();
              }
              base.Dispose(disposing);
          }
  
          #region Windows Form Designer generated code
  
          /// &lt;summary&gt;
          /// Required method for Designer support - do not modify
          /// the contents of this method with the code editor.
          /// &lt;/summary&gt;
          private void InitializeComponent()
          {
              System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
              this.label11 = new System.Windows.Forms.Label();
              this.groupBox1 = new System.Windows.Forms.GroupBox();
              this.btnShow = new System.Windows.Forms.Button();
              this.cmbMonth = new System.Windows.Forms.ComboBox();
              this.label6 = new System.Windows.Forms.Label();
              this.cmbYear = new System.Windows.Forms.ComboBox();
              this.btnClose = new System.Windows.Forms.Button();
              this.dgAttendanceLog = new System.Windows.Forms.DataGridView();
              this.btnSave = new System.Windows.Forms.Button();
              this.statusStrip1 = new System.Windows.Forms.StatusStrip();
              this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
              this.slno = new System.Windows.Forms.DataGridViewTextBoxColumn();
              this.empId = new System.Windows.Forms.DataGridViewTextBoxColumn();
              this.empName = new System.Windows.Forms.DataGridViewTextBoxColumn();
              this.workedDays = new System.Windows.Forms.DataGridViewTextBoxColumn();
              this.absentDays = new System.Windows.Forms.DataGridViewTextBoxColumn();
              this.weeklyOff = new System.Windows.Forms.DataGridViewTextBoxColumn();
              this.lateCominBy = new System.Windows.Forms.DataGridViewTextBoxColumn();
              this.earlyGoingBy = new System.Windows.Forms.DataGridViewTextBoxColumn();
              this.groupBox1.SuspendLayout();
              ((System.ComponentModel.ISupportInitialize)(this.dgAttendanceLog)).BeginInit();
              this.statusStrip1.SuspendLayout();
              this.SuspendLayout();
              // 
              // label11
              // 
              this.label11.AutoSize = true;
              this.label11.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.label11.ForeColor = System.Drawing.SystemColors.ControlText;
              this.label11.Location = new System.Drawing.Point(14, 42);
              this.label11.Name = "label11";
              this.label11.Size = new System.Drawing.Size(49, 13);
              this.label11.TabIndex = 106;
              this.label11.Text = "Month :";
              // 
              // groupBox1
              // 
              this.groupBox1.Controls.Add(this.btnShow);
              this.groupBox1.Controls.Add(this.cmbMonth);
              this.groupBox1.Controls.Add(this.label11);
              this.groupBox1.Controls.Add(this.label6);
              this.groupBox1.Controls.Add(this.cmbYear);
              this.groupBox1.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.groupBox1.ForeColor = System.Drawing.Color.MidnightBlue;
              this.groupBox1.Location = new System.Drawing.Point(12, 12);
              this.groupBox1.Name = "groupBox1";
              this.groupBox1.Size = new System.Drawing.Size(688, 79);
              this.groupBox1.TabIndex = 108;
              this.groupBox1.TabStop = false;
              this.groupBox1.Text = "Select";
              // 
              // btnShow
              // 
              this.btnShow.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.btnShow.ForeColor = System.Drawing.Color.Black;
              this.btnShow.Location = new System.Drawing.Point(533, 34);
              this.btnShow.Name = "btnShow";
              this.btnShow.Size = new System.Drawing.Size(75, 33);
              this.btnShow.TabIndex = 108;
              this.btnShow.Text = "Show";
              this.btnShow.UseVisualStyleBackColor = true;
              this.btnShow.Click += new System.EventHandler(this.btnShow_Click);
              // 
              // cmbMonth
              // 
              this.cmbMonth.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.cmbMonth.FormattingEnabled = true;
              this.cmbMonth.Items.AddRange(new object[] {
              "Month",
              "Jan",
              "Feb",
              "Mar",
              "Apr",
              "May",
              "Jun",
              "Jul",
              "Aug",
              "Sep",
              "Oct",
              "Nov",
              "Dec"});
              this.cmbMonth.Location = new System.Drawing.Point(83, 34);
              this.cmbMonth.Name = "cmbMonth";
              this.cmbMonth.Size = new System.Drawing.Size(125, 21);
              this.cmbMonth.TabIndex = 104;
              // 
              // label6
              // 
              this.label6.AutoSize = true;
              this.label6.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.label6.ForeColor = System.Drawing.SystemColors.ControlText;
              this.label6.Location = new System.Drawing.Point(283, 42);
              this.label6.Name = "label6";
              this.label6.Size = new System.Drawing.Size(39, 13);
              this.label6.TabIndex = 107;
              this.label6.Text = "Year :";
              // 
              // cmbYear
              // 
              this.cmbYear.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.cmbYear.FormattingEnabled = true;
              this.cmbYear.Location = new System.Drawing.Point(341, 34);
              this.cmbYear.Name = "cmbYear";
              this.cmbYear.Size = new System.Drawing.Size(125, 21);
              this.cmbYear.TabIndex = 105;
              // 
              // btnClose
              // 
              this.btnClose.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.btnClose.ForeColor = System.Drawing.Color.Black;
              this.btnClose.Location = new System.Drawing.Point(625, 501);
              this.btnClose.Name = "btnClose";
              this.btnClose.Size = new System.Drawing.Size(75, 33);
              this.btnClose.TabIndex = 9;
              this.btnClose.Text = "Close";
              this.btnClose.UseVisualStyleBackColor = true;
              this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
              // 
              // dgAttendanceLog
              // 
              this.dgAttendanceLog.AllowUserToAddRows = false;
              dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightCyan;
              this.dgAttendanceLog.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
              this.dgAttendanceLog.BackgroundColor = System.Drawing.Color.WhiteSmoke;
              this.dgAttendanceLog.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
              this.dgAttendanceLog.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
              this.slno,
              this.empId,
              this.empName,
              this.workedDays,
              this.absentDays,
              this.weeklyOff,
              this.lateCominBy,
              this.earlyGoingBy});
              this.dgAttendanceLog.Location = new System.Drawing.Point(12, 107);
              this.dgAttendanceLog.Name = "dgAttendanceLog";
              this.dgAttendanceLog.RowHeadersVisible = false;
              this.dgAttendanceLog.Size = new System.Drawing.Size(688, 388);
              this.dgAttendanceLog.TabIndex = 109;
              this.dgAttendanceLog.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgAttendanceLog_CellDoubleClick);
              // 
              // btnSave
              // 
              this.btnSave.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.btnSave.ForeColor = System.Drawing.Color.Black;
              this.btnSave.Location = new System.Drawing.Point(544, 501);
              this.btnSave.Name = "btnSave";
              this.btnSave.Size = new System.Drawing.Size(75, 33);
              this.btnSave.TabIndex = 110;
              this.btnSave.Text = "Save";
              this.btnSave.UseVisualStyleBackColor = true;
              this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
              // 
              // statusStrip1
              // 
              this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
              this.toolStripStatusLabel1});
              this.statusStrip1.Location = new System.Drawing.Point(0, 545);
              this.statusStrip1.Name = "statusStrip1";
              this.statusStrip1.Size = new System.Drawing.Size(711, 22);
              this.statusStrip1.TabIndex = 111;
              this.statusStrip1.Text = "statusStrip1";
              // 
              // toolStripStatusLabel1
              // 
              this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
              this.toolStripStatusLabel1.Size = new System.Drawing.Size(298, 17);
              this.toolStripStatusLabel1.Text = "Note : Please Single click on respective field for manual entry";
              // 
              // slno
              // 
              this.slno.HeaderText = "Sl No.";
              this.slno.Name = "slno";
              this.slno.Width = 50;
              // 
              // empId
              // 
              this.empId.HeaderText = "Emp. ID";
              this.empId.Name = "empId";
              this.empId.Width = 75;
              // 
              // empName
              // 
              this.empName.HeaderText = "Emp. Name";
              this.empName.Name = "empName";
              this.empName.Width = 125;
              // 
              // workedDays
              // 
              this.workedDays.HeaderText = "Worked Days";
              this.workedDays.Name = "workedDays";
              this.workedDays.ReadOnly = true;
              this.workedDays.Width = 75;
              // 
              // absentDays
              // 
              this.absentDays.HeaderText = "Absent Days";
              this.absentDays.Name = "absentDays";
              this.absentDays.ReadOnly = true;
              this.absentDays.Width = 75;
              // 
              // weeklyOff
              // 
              this.weeklyOff.HeaderText = "Weekly Off";
              this.weeklyOff.Name = "weeklyOff";
              this.weeklyOff.Width = 75;
              // 
              // lateCominBy
              // 
              this.lateCominBy.HeaderText = "Late Going By (in Days)";
              this.lateCominBy.Name = "lateCominBy";
              // 
              // earlyGoingBy
              // 
              this.earlyGoingBy.HeaderText = "Early Going By (in Days)";
              this.earlyGoingBy.Name = "earlyGoingBy";
              // 
              // AttendanceLog
              // 
              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
              this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
              this.BackColor = System.Drawing.Color.WhiteSmoke;
              this.ClientSize = new System.Drawing.Size(711, 567);
              this.ControlBox = false;
              this.Controls.Add(this.statusStrip1);
              this.Controls.Add(this.btnSave);
              this.Controls.Add(this.dgAttendanceLog);
              this.Controls.Add(this.btnClose);
              this.Controls.Add(this.groupBox1);
              this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
              this.Name = "AttendanceLog";
              this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
              this.Text = "Attendance Log";
              this.Load += new System.EventHandler(this.AttendanceLog_Load);
              this.groupBox1.ResumeLayout(false);
              this.groupBox1.PerformLayout();
              ((System.ComponentModel.ISupportInitialize)(this.dgAttendanceLog)).EndInit();
              this.statusStrip1.ResumeLayout(false);
              this.statusStrip1.PerformLayout();
              this.ResumeLayout(false);
              this.PerformLayout();
  
          }
  
          #endregion
  
          private System.Windows.Forms.Label label11;
          private System.Windows.Forms.GroupBox groupBox1;
          private System.Windows.Forms.Button btnShow;
          private System.Windows.Forms.Button btnClose;
          private System.Windows.Forms.DataGridView dgAttendanceLog;
          private System.Windows.Forms.ComboBox cmbMonth;
          private System.Windows.Forms.Label label6;
          private System.Windows.Forms.ComboBox cmbYear;
          private System.Windows.Forms.Button btnSave;
          private System.Windows.Forms.StatusStrip statusStrip1;
          private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
          private System.Windows.Forms.DataGridViewTextBoxColumn slno;
          private System.Windows.Forms.DataGridViewTextBoxColumn empId;
          private System.Windows.Forms.DataGridViewTextBoxColumn empName;
          private System.Windows.Forms.DataGridViewTextBoxColumn workedDays;
          private System.Windows.Forms.DataGridViewTextBoxColumn absentDays;
          private System.Windows.Forms.DataGridViewTextBoxColumn weeklyOff;
          private System.Windows.Forms.DataGridViewTextBoxColumn lateCominBy;
          private System.Windows.Forms.DataGridViewTextBoxColumn earlyGoingBy;
      }
  }
  </code></pre>