Results 1 to 3 of 3

Thread: List box help

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 1999
    Location
    metairie, la usa
    Posts
    40

    Post

    hi, I need a little help with listboxes. Lets say I have list1, list2, and list3 filled with enough info that all 3 have horizontal scroll bars. How can I make my program autoscroll the list boxes with the scroll of any one. IE if I scroll list1 down I want list2 & 3 to scroll with it. Please email me at [email protected]

    Thanks
    Richard

  2. #2
    Lively Member
    Join Date
    May 1999
    Posts
    100

    Post

    Well.. This in not exactly what you asked for but what I know is it not possible to do that in pure VB (maybe with API).. You can maybe use this?
    Code:
    Option Explicit
    
    Dim i As Integer
    
    Private Sub Form_Load()
        For i = 1 To 20
            List1.AddItem i
            List2.AddItem i
            List3.AddItem i
        Next
    End Sub
    
    Private Sub List1_Click()
        i = List1.ListIndex
        List2.ListIndex = i
        List3.ListIndex = i
    End Sub
    
    Private Sub List2_Click()
        i = List2.ListIndex
        List1.ListIndex = i
        List3.ListIndex = i
    End Sub
    
    Private Sub List3_Click()
        i = List3.ListIndex
        List1.ListIndex = i
        List2.ListIndex = i
    End Sub
    but If I was you I should use ListView that you finds is Microsoft Common Controls 6.0

    and set the property View to lvwReport. It looks just like Explorer's filelist

    ------------------
    Best Regards rancor
    [email protected]
    http://www.sajberhem.nu

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Post

    It's actually pretty easy to do. Here is an example where the ListBoxes are members of a control array, but you can adapt this for seperate TextBoxes as well.
    Code:
    Private Sub List1_Scroll(Index As Integer)
    
        Select Case Index
            Case 0
                List1(1).TopIndex = List1(0).TopIndex
                List1(2).TopIndex = List1(0).TopIndex
            Case 1
                List1(0).TopIndex = List1(1).TopIndex
                List1(2).TopIndex = List1(1).TopIndex
            Case 2
                List1(0).TopIndex = List1(2).TopIndex
                List1(1).TopIndex = List1(2).TopIndex
        End Select
        
    End Sub
    ------------------
    Marty
    Why is it called lipstick if you can still move your lips?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width