Searched everywhere for a way to synchronise the scrolling of 2 listviews, found a few that were too big and complicated or did not work properly, so made my own by trickery
You need 2 or more listviews and a vertical scroller, get them from the components/microsoft common tools 6
put the first listview where you want it and the second overlapping the first so that it hides the built in vertical scrollbar
put the scrollbar on top of the last listview so that it hides the built in scrollbar
use the scroller (vscroll1) scroll to get the values and the selecteditem of the listviews to set the position
Dont forget to set the min and max of the scrollbar, the min should be at least 1 and the max the number of items in the listviews
alter it to suit yourself, its free. vb 6Code:Dim Addit As Object Dim a, b As String Dim z, y As Integer Private Sub Form_Load() Form1.Visible = True With ListView1.ColumnHeaders.Add .Width = (ListView1.Width - 300) .Text = "Test" End With With ListView2.ColumnHeaders.Add .Width = (ListView2.Width - 300) .Text = "Test1" End With For z = 1 To 200 Set Addit = ListView1.ListItems.Add(, , "Line" & Str(z)) Set Addit = ListView2.ListItems.Add(, , "Line" & Str(z)) Next z End Sub Private Sub VScroll1_Scroll() ListView2.SelectedItem = ListView2.ListItems(VScroll1.Value) ListView2.SelectedItem.EnsureVisible ListView1.SelectedItem = ListView1.ListItems(VScroll1.Value) ListView1.SelectedItem.EnsureVisible End Sub




Reply With Quote