Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
Me.DataGridView2.ClearSelection()
If Me.DataGridView1.SelectedRows.Count <> 0 Then
For r As Integer = 0 To Me.DataGridView2.Rows.Count - 1
If Me.DataGridView1.Rows(Me.DataGridView1.CurrentRow.Index).Cells(0).Value = Me.DataGridView2.Rows(r).Cells(0).Value Then
Me.DataGridView2.Rows(r).Selected = True
'Scroll ลงไปที่ row ที่เลือก
DataGridView2.FirstDisplayedScrollingRowIndex = r
Exit For
End If
Next
End If
End Sub