I got this working for a ListBox and a RichTextBox but only one way... Meaning that scrolling the RTB will scroll the LB but not the opposite
Here is the code... Put it in the VScroll function of the RTB
Dim lineNumber As Integer = 0
lineNumber is a global variable...
Dim firstVisibleChar As Integer = RichTextBox1.GetCharIndexFromPosition(New Point(0, 0))
lineNumber = RichTextBox1.GetLineFromCharIndex(firstVisibleChar)
ListBox1.TopIndex = lineNumber
I know we can simplify this code more, but I've made it a bit longer so that anyone can easily understand it...