Question How to make VerticalScrollBar follow ur SelectedIndex in DataGridView programmaticaly

capedech

Well-known member
Joined
Oct 29, 2008
Messages
62
Programming Experience
Beginner
Hi,
I have a DataGridView(Dgv1), which only will show 5 rows on the Screen.
I have 10 records that I wanna put on that DataGridView.

Then, I want to select the last row :
Dgv1.Rows(Dgv1.RowCount - 1).Selected = True

But then, when I started the program. The Vertical ScrollBar didn't go to where the row was selected.

Please help me, How to make the Vertical ScrollBar follow ur Selected Index in DataGridView programmaticaly..


Thanks in Advance.

Regards,

Nb. Please forgive my bad english
 
Making a row selected does NOT make it the current row. You can have multiple rows selected, i.e. highlighted, in the grid while only one can be the current row. Instead of selecting a row, set the CurrentCell to a cell in that row, thus making it the current row.
 
Making a row selected does NOT make it the current row. You can have multiple rows selected, i.e. highlighted, in the grid while only one can be the current row. Instead of selecting a row, set the CurrentCell to a cell in that row, thus making it the current row.
Thanks bro, I'll try it tommorow.
 
Really thank u for ur suggestion. It worked perfectly.
One more question.
Can I do it too to ListView ?

Thanks in Advance.

Regards,
 
Back
Top