Have a look at
datagridview.firstdisplayedscrollingrowindex[
^]
E.g.
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
if (dataGridView1.SelectedRows.Count == 0) return;
dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.SelectedRows[0].Index;
}
The first line is included because the SelectionChanged event appears to be fired when populating the dataGridView
[Edit] - The solution in VB.NET - mea culpa
Private Sub DataGridView1_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGridView1.SelectionChanged
If DataGridView1.SelectedRows.Count = 0 Then Return
DataGridView1.FirstDisplayedScrollingRowIndex = DataGridView1.SelectedRows(0).Index
End Sub