For the 1st problem, you don't need a separate array of strings. Remove lines of code dealing with ItemData if your listbox doesn't use the ItemData property to store anything. Also, change control names as needed to match yours.
Code:Private Sub cmdUpDn_Click(Index As Integer) Dim sItem As String, lData As Long Dim lDir As Long If Index = 0 Then ' up If List1.ListIndex = 0 Then Exit Sub ' at top already lDir = -1 Else If List1.ListIndex = List1.ListCount - 1 Then Exit Sub ' at bottom already lDir = 1 End If sItem = List1.List(List1.ListIndex) lData = List1.ItemData(List1.ListIndex) List1.List(List1.ListIndex) = List1.List(List1.ListIndex + lDir) List1.ItemData(List1.ListIndex) = List1.ItemData(List1.ListIndex + lDir) List1.List(List1.ListIndex + lDir) = sItem List1.ItemData(List1.ListIndex + lDir) = lData List1.ListIndex = List1.ListIndex + lDir End Sub




Reply With Quote