How can i scroll my datagridview to its last row in the underlying dataset.
I am doing this because i want to see the value inserted in.
NOTE:I am not using bindingsource to fill my datagridview.
Printable View
How can i scroll my datagridview to its last row in the underlying dataset.
I am doing this because i want to see the value inserted in.
NOTE:I am not using bindingsource to fill my datagridview.
Do you mean show the last row without selecting it or actually selecting the last row?
showing the last row, but showing and selecting it too will be more flavor.
Still looking forward to resolving this.
VB Code:
'Scroll to the last row. Me.DataGridView1.FirstDisplayedScrollingRowIndex = Me.DataGridView1.RowCount - 1 'Select the last row. Me.DataGridView1.Rows(Me.DataGridView1.RowCount - 1).Selected = True
Thanks.
this thread just helped me out.
Thanks jmcilhinney.
In my case, a grid is always open, fetching records from a text file, which is being populated continously. The last row gets selected but when new rows are added, multiple rows are selected.
I can traverse all the rows and unselect them before selecting the last row. but i am talking about 50000 rows here.
Any advice.
Regards.
Fantastic.
You made my day.
Thanks and Regards
You can use too : Me.DataGridView1.ClearSelection()
'Scroll to the last row.
Me.DataGridView1.FirstDisplayedScrollingRowIndex = Me.DataGridView1.RowCount - 1
'Clear the last selection
'Me.DataGridView1.ClearSelection()
'Select the last row.
Me.DataGridView1.Rows(Me.DataGridView1.RowCount - 1).Selected = True
Why are you replying to a post that is almost a year old and resolved?
thank you very much i was search for select last rows add with auto timer refresh
change code a bit with timer
Code:Private Sub Timer5_Tick(sender As Object, e As EventArgs) Handles Timer5.Tick
UpdateDGV2()
End Sub
Private Sub UpdateDGV2()
'Scroll to the last row.
Me.Table_reportDataGridView.FirstDisplayedScrollingRowIndex = Me.Table_reportDataGridView.RowCount - 1
'Select the last row.
Me.Table_reportDataGridView.Rows(Me.Table_reportDataGridView.RowCount - 1).Selected = True
End Sub