In Visual Basic, do this to select a row in a DataGridView ; the selected line will appear with highlighted color, but note that the cursor position does not change:
Grid.Rows(0).Selected = True
Change the cursor position:
Grid.CurrentCell = Grid.Rows(0).Cells(0)
The concatenation of the lines above will position the cursor and select the line. This is the standard procedure for focusing and selecting a row in a DataGridView :
Grid.CurrentCell = Grid.Rows(0).Cells(0) Grid.Rows(0).Selected = True
Rodrigo T. Nov 14 '13 at 20:39 2013-11-14 20:39
source share