If you have dgv1 and dgv2, you can create something like
dgv1.Scroll += new System.Windows.Forms.ScrollEventHandler(dgv1_Scroll);
Then, in the dgv1_Scroll method, you can use the FirstDisplayedScrollingRowIndex property:
dgv2.FirstDisplayedScrollingRowIndex = dgv1.FirstDisplayedScrollingRowIndex
Of course, if dgv has a different number of rows, you need to avoid IndexOutOfRange exceptions by checking each dgv row count.
source
share