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

Started by nandagopal, May 21, 2009, 12:41 AM

previous topic - next topic
Go Down

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.


Code: [Select]
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

Go Up
 

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

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's 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 submit/post or alt+p preview
IT Acumens Web Design Chennai | GinGly :: Mobile SMS Backup | CineBuzz :: Latest Cinema News | My Kids Diary :: Kids magical moment :: Book domain name @ 99 Rs monthly
Copyright 2005 - 2019 :: IT Acumens :: All Rights Reserved.
ITAcumens Forum with 2 lakhs post running for 14 years - Powered by IT Acumens Dedicated Server