I hope this example will help you :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
List<int> CheckBoxChecked = new List<int>();
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.RowCount = 10;
int i = 0;
foreach (DataGridViewRow Row in dataGridView1.Rows)
{
i++;
Row.Cells[0].Value = i;
Row.Cells[1].Value = i+10;
if (i % 2 == 0)
{
DataGridViewCheckBoxCell dgvcbcell = (DataGridViewCheckBoxCell) Row.Cells[2];
dgvcbcell.Value = true;
}
}
}
private void BtnSubmit_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow Row in dataGridView1.Rows)
{
DataGridViewCheckBoxCell dgvcbcell = (DataGridViewCheckBoxCell)Row.Cells[2];
if (true == dgvcbcell.EditedFormattedValue)
{
CheckBoxChecked.Add(Row.Index+1);
}
}
}
}
}