I'm not sure why I can't find this function, maybe because it's late, but how do you set the view of a DGV to the top?
Thanks
Printable View
I'm not sure why I can't find this function, maybe because it's late, but how do you set the view of a DGV to the top?
Thanks
Can you be more specific please.
Like if the scroll bar is anywhere but the top, then set it to the top so you see the first row.
vb.net Code:
Private Sub Button1_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs _ ) Handles Button1.Click DataGridView1.FirstDisplayedScrollingRowIndex = 0 End Sub
So, what you mean is you want to scroll the DataGridView to the top, correct? Scroll bars scroll, so using the word "scroll" would have been the best way to describe your issue.
You probably can't find it because you were making assumptions about what it would be called. In cases where you can't immediately see what you want you've just got to open the member listing in the documentation and start reading down the list. Doing that, I'm sure you'd have known that you'd found what you were looking for when you saw the FirstDisplayedScrollingRowIndex describe as:Set that property to the index of the first row, i.e. zero, and you are good to go.Quote:
Gets or sets the index of the row that is the first row displayed on the DataGridView.
Thanks guys