Little modify your code.
you write your code like:-
SqlConnection Conn = new SqlConnection(@"server=.\Mssql2008;database=Basij;integrated security=true;");
SqlCommand delcmd = new SqlCommand();
if (dataGridView1.Rows.Count > 1 && dataGridView1.SelectedRows[0].Index != dataGridView1.Rows.Count - 1)
{
delcmd.CommandText = "DELETE FROM Tblregister WHERE Fldcode=" + dataGridView1.SelectedRows[0].Cells[0].Value.ToString() + "";
Conn.Open();
delcmd.Connection=Conn;
delcmd.ExecuteNonQuery();
Conn.Close();
dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);
}