|
-
May 13th, 2000, 08:30 AM
#6
Member
This seems to work. Create a new form with a listbox, and two command buttons. cmdUp and cmdDown. When the user highlights an item in the list, then clicks the up or down button, the highlighted item will move up or down...
Private Sub cmddown_Click()
Dim ts As String
Dim tindex As Integer
tindex = List1.ListIndex
If tindex < List1.ListCount - 1 Then
ts = List1.List(tindex + 1)
List1.List(tindex + 1) = List1.List(tindex)
List1.List(tindex) = ts
List1.ListIndex = tindex + 1
End If
End Sub
Private Sub cmdup_Click()
Dim ts As String
Dim tindex As Integer
tindex = List1.ListIndex
If tindex > 0 Then
ts = List1.List(tindex - 1)
List1.List(tindex - 1) = List1.List(tindex)
List1.List(tindex) = ts
List1.ListIndex = tindex - 1
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 10
Me.List1.AddItem Str(i)
Next
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|