How do I programmatically scroll a winforms datagridview control?

Well, since this is a datagridview… Sorry for the ‘winforms’ in the question… but I could just do this.. scrolling up or down one row.

Scroll up:

this.FirstDisplayedScrollingRowIndex = this.FirstDisplayedScrollingRowIndex - 1

Scroll Down:

this.FirstDisplayedScrollingRowIndex = this.FirstDisplayedScrollingRowIndex + 1;

You’ve gotta make sure to check that the numbers don’t go out of bounds though.

Leave a Comment