first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

VB Code: Sorting ListBox Items with a Two-Button Control Array

Private Sub cmdFieldOrder_Click(Index As Integer) ' 'This sub responds to the click event of 'a two-button control array called cmdFieldOrder. 'It manipulates the items in the List Box lstFields. ' Dim strList As String Dim intListIndex As Integer

Select Case Index
    Case 0
        With Me.lstFields
            If .ListIndex > 0 Then
                strList = .List(.ListIndex)
                intListIndex = .ListIndex
                Call .RemoveItem(.ListIndex)
                Call .AddItem(strList, intListIndex - 1)
            End If
        End With
    Case 1
        With Me.lstFields
            If 0 <= .ListIndex _
                And .ListIndex < .ListCount - 1 Then
                strList = .List(.ListIndex)
                intListIndex = .ListIndex
                Call .RemoveItem(.ListIndex)
                Call .AddItem(strList, intListIndex + 1)
                .ListIndex = intListIndex + 1
            End If
        End With
End Select

End Sub

mod date: 1999-04-24T16:19:42.000Z