CodeItBetter Programming Another VB Programming Blog

How to move up and down in a file listbox using two buttons?

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:

  1. How to select items in ListBox with right mouse button
  2. How to load items from a Listbox into an array
  3. How to Select all Items in ListBox
  4. How to detect on which item the Mouse is hover on ListBox
  5. How to Drag/Move items from one List Box to another List Box

Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.