Code:
Private Sub cmdUp_Click()
' only if the first item isn't the current one
If List1.ListIndex >= 0 Then
' add a duplicate item up in the listbox
List1.AddItem List1.Text, List1.ListIndex - 1
' make it the current item
List1.ListIndex = List1.ListIndex - 2
' delete the old occurrence of this item
List1.RemoveItem List1.ListIndex + 2
End If
End Sub
Private Sub cmdDown_Click()
' only if the last item isn't the current one
If List1.ListIndex <> -1 And List1.ListIndex < List1.ListCount - 1 Then
' add a duplicate item down in the listbox
List1.AddItem List1.Text, List1.ListIndex + 2
' make it the current item
List1.ListIndex = List1.ListIndex + 2
' delete the old occurrence of this item
List1.RemoveItem List1.ListIndex - 2
End If
End Sub