Results 1 to 3 of 3

Thread: Scrolling ListBox

  1. #1
    Guest
    How can I get the listbox selection to change when the user scrolls down through the options? I am using VB5.

  2. #2
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I'm not exactly sure what you want to do, but if you use this code with a listbox that is 5 items high, the middle item will stay highlighted.
    Code:
    Private Sub List1_Scroll()
    
        If List1.TopIndex + 2 > List1.ListCount - 1 Then
            List1.ListIndex = List1.ListCount - 1
        Else
            List1.ListIndex = List1.TopIndex + 2
        End If
    End Sub

  3. #3
    Guest
    I have a listbox. It has preset values. When my program runs, I scroll the list box. When I scroll it does not change the selected item. I want it to. I can find no reference to directional scrolling or I would add or delete to the .listindex based on whether or not they are sctrolling up or down. The .text value does not even change when it shows up different in the box.

    Any help would be greatly appreciated.

    Boothman

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