VScroll Row In DataGrid

daPoet

Member
Joined
Jul 22, 2008
Messages
23
Programming Experience
Beginner
How can I automatically scroll a record to the top of it's datagrid window.
 
Hello

VB.NET:
Me.yourDataGridView.CurrentCell = Me.yourDataGridView.Item(0,0)
This should do the Trick. You might need to catch an error if there are no rows/columns within the Grid.

Bobby
 
Thanks for the input, however that code returns the focus to the row at the top of the Grid,


What I want to do is force the grid to scroll up by a certain amount of rows.

I'm going use a work around though. When I look back into all of this, I may be just trying to do something that really doesnt do anything significant..

Thanks still.
 
CurrentCell work to bring any cell into view, but will not ensure it is the topmost cell in view, to do that you have to first set a current cell much lower in the list then your selected. For example to get row 5 to top first set for example row 23 then 5. As you know it is not possible to bring the last rows to top, DGV will only scroll until last row is visible at bottom.
 
Back
Top