---
title: "How to add checkbox in datagridview in C#"  
description: "How to add checkbox in datagridview in C#"  
author: "Anonymous User"  
published: 2013-06-15  
updated: 2013-06-15  
canonical: https://www.mindstick.com/forum/1155/how-to-add-checkbox-in-datagridview-in-c-sharp  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# How to add checkbox in datagridview in C#

Hi Mindstickians,i want to [add](https://www.mindstick.com/forum/12983/add-address-in-textbox-when-page-is-load-and-if-i-search-address-in-textbox-show-in-map-by-javascript) a [checkbox](https://www.mindstick.com/articles/291/how-should-use-checkbox-control-in-vb-dot-net) in datagriview in C#.

Can anybody provide me [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) for add checkbox in [datagridview](https://www.mindstick.com/articles/607/working-with-datagridview-in-vc-sharp) in C#.

Thanks in advance.

## Replies

### Reply by Sumit Kesarwani

Hi Ankita,\

The following C# program shows how to add a CheckBox in Cell of a DataGridView control and set the third row checkbox value as true.

```
using System;using System.Data;using System.Windows.Forms;using System.Data.SqlClient; namespace WindowsApplication1{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }         private void button1_Click(object sender, EventArgs e)        {            dataGridView1.ColumnCount = 3;            dataGridView1.Columns[0].Name = "Product ID";            dataGridView1.Columns[1].Name = "Product Name";            dataGridView1.Columns[2].Name = "Product Price";             string[] row = new string[] { "1", "Product 1", "1000" };            dataGridView1.Rows.Add(row);            row = new string[] { "2", "Product 2", "2000" };            dataGridView1.Rows.Add(row);            row = new string[] { "3", "Product 3", "3000" };            dataGridView1.Rows.Add(row);            row = new string[] { "4", "Product 4", "4000" };            dataGridView1.Rows.Add(row);             DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();            dataGridView1.Columns.Add(chk);            chk.HeaderText = "Check Data";            chk.Name = "chk";            dataGridView1.Rows[2].Cells[3].Value = true;        }    }}
```


---

Original Source: https://www.mindstick.com/forum/1155/how-to-add-checkbox-in-datagridview-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
