private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
foreach (DataGridViewRow dr in dataGridView1.Rows)
{
dr .Cells[0].Value = dr .Index+1;
}
}