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

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