In terms of UI behavior: I think any automated/repeated selecting/deselecting of elements of a Control is not a good practice, and any multiple clicks from code on a Button which may also have visual effect are a bad practice.
Using a 'while loop, and violating the advice above :):
private void btn_Click(object sender, EventArgs e)
{
keepGoing = true;
DataGridViewRow currentRow;
int currentNdx;
while (keepGoing)
{
currentNdx = dataGridView1.SelectedRows[0].Index;
if (currentNdx < dataGridView1.RowCount - 1)
{
dataGridView1.Rows[currentNdx].Selected = false;
currentRow = dataGridView1.Rows[++currentNdx];
currentRow.Selected = true;
keepGoing = calculateAverage(currentRow, currentNdx);
}
else
{
keepGoing = false;
}
}
}
private bool calculateAverage(DataGridViewRow currentRow, int currentNdx)
{
return true;
}