
DataGridView kontrolünde değerler DataSource özelliği set edilerek değiştirilse de kontrole Edit Columns komutu ile DataGridViewCheckBox türünde bir kontrol eklenebilir.

Kontrol eklendikten sonra programatik olarak DataSource özelliği set edildikten sonra, tüm satırların 0 numaralı sütünun değerlerinin CheckBox değerlerinin set edilmesi
gerekir.
for (int i = 1; i < grdKararAtaList.Rows.Count; i++)
{
DataGridViewCheckBoxCell c = (DataGridViewCheckBoxCell)grdList.Rows[i].Cells[0];
c.Value = false;
}
Bir satır üzerindeki Seç DataGridViewCheckBox'ının seçili ya da seçili olmama durumu için ise DataGridView'ın Cell Click olayına aşağıdaki satırların yazılması gerekir.
private void grdList_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0)
{
if (e.RowIndex != -1)
{
DataGridViewCheckBoxCell c = (DataGridViewCheckBoxCell)grdList.Rows[e.RowIndex].Cells[0];
c.Value = !Convert.ToBoolean(c.Value);
}
}
}
Son olarak da hangi satırların ChekckBox'ının seçildiğini tespit etmek için ise aşağıdaki kod satırı kullanılabilir.
List<int> IDList = new List<int>();
for (int i = 0; i < grdKararAtaList.Rows.Count; i++)
{
DataGridViewCheckBoxCell c = (DataGridViewCheckBoxCell)grdKararAtaList.Rows[i].Cells[0];
if (c.Value != null)
{
if ((Boolean)c.Value)
IDList.Add(Convert.ToInt32(grdKararAtaList.Rows[i].Cells[10].Value.ToString()));
}
}