Change Order by ListBox Items by Pressing Button

I want to have a button next to a listbox that will move the selected item down one in the overall order of items in the list box.  What is the best way to handle.
cadwal01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

svcoderCommented:
You could create a new ListItem from the SelectedItem (lb.SelectedItem) then get the item's index position (lb.SelectedIndex) then remove that item from the items collection (lb.Items.RemoveAt), then add the newly created ListItem back into the Item collection ( lb.Items.Insert( int index, ListItem item) ) where you want it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Alpesh PatelCommented:
here is the scenario that you can apply on the click event of command button

    Dim l_ListItem As New ListItem
        l_ListItem = ListBox1.SelectedItem
        Dim l_intItem As Integer

        l_intItem = ListBox1.SelectedIndex

        If Not l_intItem = ListBox1.Items.Count - 1 Then
            l_intItem = l_intItem + 1
        End If
        ListBox1.Items.Remove(ListBox1.SelectedItem)
        ListBox1.Items.Insert(l_intItem, l_intItem)
       
0
cadwal01Author Commented:
You are both correct.  Key was getting it as a listitem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.