Results 1 to 3 of 3

Thread: scrolling a disabled listbox???

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    Germany
    Posts
    84

    Question

    Hi!

    Is there any way to enable scrolling in a listbox, which allows no entries (enabled=false)???

    Thanks for your help


  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    If you disable the listbox, scrolling will not be possible. However, you can leave it enabled, and as soon as the user clicks an entry, you can set the ListIndex to -1 which means no entries are selected (and the highlight will be removed from the entry that the user clicked). For example:

    Private Sub List1_Click()
    List1.ListIndex = -1
    End Sub

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    You could put a vertical scroll bar over the top of list box scroll bar and scroll it that way.
    Code:
    Option Explicit
    
    
    Private Sub Form_Load()
    Dim i As Integer
    For i = 0 To 20
      List1.AddItem "item " & i
    Next i
    
    List1.Enabled = False
    VScroll1.Max = List1.ListCount - 1
    
    End Sub
    
    
    Private Sub VScroll1_Change()
    'choose one of the following:
    
    'List1.ListIndex = VScroll1.Value
    
    List1.TopIndex = VScroll1.Value
    End Sub
    Mark
    -------------------

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