Monday, 7 January 2008

Scroll a Windows Form DataGridView to a specific row

I have a Windows Form which contains a TextBox and a DataGridView. When a user enters anything I need to do a search and make the grid scroll to the row matched.

I was struggling for a while for the scrolling until I came across this property: FirstDisplayedScrollingRowIndex. It's simple, just assign the row index value to this property and the grid will scroll to the row and show the row as the first row in the visible area.

No comments: