BIGZIPZ1
asked on
How do I use FirstDisplayedScrollingRowIndex on the fly?
Hi there, I have some code below which will make the first displayed row in my datagrid whatever row my mouse is currently clicked on.
Is there a way to change it so that "row" variable could contain a number that I choose so that, say, when I click Button3 it always sets "row" as the tenth row in the datagrid even though no row is selected by the mouse etc?
I tried changing to Dim row as Integer = "10" but I get an error that CurrentRow cannot be set to an integer.
Thanks everyone
Is there a way to change it so that "row" variable could contain a number that I choose so that, say, when I click Button3 it always sets "row" as the tenth row in the datagrid even though no row is selected by the mouse etc?
I tried changing to Dim row as Integer = "10" but I get an error that CurrentRow cannot be set to an integer.
Thanks everyone
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim row As DataGridViewRow
row = JackBennyDataGridView.CurrentRow
JackBennyDataGridView.FirstDisplayedScrollingRowIndex = JackBennyDataGridView.Rows.IndexOf(row)
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.