News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

buttons to slide a ListBox's multiple selection up or down in Visual Basic .NET

Started by nandagopal, May 20, 2009, 07:11 PM

Previous topic - Next topic

nandagopal

To slide the selections up, loop through the items and use SetSelected to give each item the same selected value as the one below it.

To slide the selections down, loop through the items and use SetSelected to give each item the same selected value as the above following it.


Private Sub btnUp_Click(...) Handles btnUp.Click
    For i As Integer = 0 To lstAnimals.Items.Count - 2
        lstAnimals.SetSelected(i, lstAnimals.GetSelected(i _
            + 1))
    Next i
    lstAnimals.SetSelected(lstAnimals.Items.Count - 1, _
        False)
End Sub

Private Sub btnDown_Click(...) Handles btnDown.Click
    For i As Integer = lstAnimals.Items.Count - 1 To 1 Step _
        -1
        lstAnimals.SetSelected(i, lstAnimals.GetSelected(i _
            - 1))
    Next i
    lstAnimals.SetSelected(0, False)
End Sub



dhoni

this program is very useful to me
it gives more information
this program use for button to slide listbox multiplemselection up or down
this program is use in vb.net

Quick Reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it has been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S post or ALT+P preview