ListBox's selection up or down

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

Previous topic - Next topic

nandagopal

To slide the selection up, see if the SelectedIndex property is greater than 0. If it is, subtract 1 from it.

To slide the selection down, see if the SelectedIndex property is less than the second largest item index. If it is, add 1 to it.


Private Sub btnUp_Click(...) Handles btnUp.Click
    If lstAnimals.SelectedIndex > 0 Then _
        lstAnimals.SelectedIndex -= 1
End Sub

Private Sub btnDown_Click(...) Handles btnDown.Click
    If lstAnimals.SelectedIndex < lstAnimals.Items.Count - _
        1 Then lstAnimals.SelectedIndex += 1
End Sub



pradeep prem

it is easy to use the website in list box up or down

it has easily given for program to use in site