|
-
May 22nd, 2006, 04:36 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] programatically scroll datagridview to last row.
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.
-
May 22nd, 2006, 04:50 AM
#2
Re: programatically scroll datagridview to last row.
Do you mean show the last row without selecting it or actually selecting the last row?
-
May 22nd, 2006, 04:59 AM
#3
Thread Starter
Hyperactive Member
Re: programatically scroll datagridview to last row.
showing the last row, but showing and selecting it too will be more flavor.
-
May 23rd, 2006, 12:21 AM
#4
Thread Starter
Hyperactive Member
Re: programatically scroll datagridview to last row.
Still looking forward to resolving this.
-
May 23rd, 2006, 12:37 AM
#5
Re: programatically scroll datagridview to last row.
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
-
May 23rd, 2006, 12:47 AM
#6
Thread Starter
Hyperactive Member
Re: programatically scroll datagridview to last row.
-
Oct 30th, 2009, 01:05 AM
#7
Lively Member
Re: [RESOLVED] programatically scroll datagridview to last row.
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.
-
Oct 30th, 2009, 01:49 AM
#8
Re: [RESOLVED] programatically scroll datagridview to last row.
 Originally Posted by cyberpd
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.
Code:
For Each row As DataGridViewRow In Me.DataGridView1.SelectedRows
row.Selected = False
Next
-
Oct 30th, 2009, 08:14 AM
#9
Lively Member
Re: [RESOLVED] programatically scroll datagridview to last row.
Fantastic.
You made my day.
Thanks and Regards
-
Sep 26th, 2010, 01:06 PM
#10
New Member
Re: [RESOLVED] programatically scroll datagridview to last row.
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
-
Sep 26th, 2010, 01:29 PM
#11
Re: [RESOLVED] programatically scroll datagridview to last row.
Why are you replying to a post that is almost a year old and resolved?
-
Apr 1st, 2018, 11:09 AM
#12
Lively Member
Re: programatically scroll datagridview to last row.
 Originally Posted by jmcilhinney
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
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|