Posted on January 5, 2009
Here is the code to move up and down in a file listbox using two buttons.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| 'Controls - How to move up and down in a file listbox using two buttons?
Private Sub cmdDown_Click()
If File1.ListIndex < File1.ListCount - 1 Then
File1.ListIndex = File1.ListIndex + 1
Else
File1.ListIndex = 0
End If
End Sub
Private Sub cmdUp_Click()
If File1.ListIndex > 0 Then
File1.ListIndex = File1.ListIndex - 1
Else
File1.ListIndex = File1.ListCount - 1
End If
End Sub |
Related posts:
- How to select items in ListBox with right mouse button
- How to load items from a Listbox into an array
- How to Select all Items in ListBox
- How to detect on which item the Mouse is hover on ListBox
- How to Drag/Move items from one List Box to another List Box