|
-
Oct 24th, 2003, 04:26 PM
#1
Thread Starter
Hyperactive Member
Listview, move item up in list
I have a listview with 5 items in it..
item1
item2
item3
item4
item5
i have two buttons, move up and move down, how do i make it so that the user can move item4 up one position which would then move item3 down one position. more or less swap...
Dim lvwItem As New ListViewItem
Dim intIndex As Integer
Dim strItem As String
Dim intPrevItem As Integer
Dim newIndex As Integer
For Each lvwItem In lvwServers.Items
If lvwItem.Selected = True Then
strItem = lvwItem.Text
intIndex = lvwItem.Index
newIndex = intIndex - 1
If newIndex > -1 Then
lvwServers.Items.RemoveAt(intIndex)
lvwServers.Items.Insert(newIndex, strItem)
End If
End If
Next
it doesn't want to work..... any help would be great thanks.
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
|