Hi!
Is there any way to enable scrolling in a listbox, which allows no entries (enabled=false)???
Thanks for your help
Printable View
Hi!
Is there any way to enable scrolling in a listbox, which allows no entries (enabled=false)???
Thanks for your help
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
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