Ok i manage to autoselect items on listbox till reach the end of list, but i need it to automatically loop back to the fist selection of indexes when it reach the end list and so on .. i need help on this part newbie here :)

if Me.Listboxs1.SelectedIndex + 1  < Me.ListBox1.items.count then
    Me.ListBox1.SelectedIndex + = 1
End if

`

Recommended Answers

All 4 Replies

If ListBox1.SelectedIndex = ListBox1.Items.Count - 1 Then
    ListBox1.SelectedIndex = 0
Else
    ListBox1.SelectedIndex += 1
End If

thanks Reverend Jim
Yes your code does select the first index after reach the end list.. but i want something that loops back and fort till i stop the timer
by the way thanks for the reply bro :)

Glad to help.

My code selects the next item in the list and wraps back to the beginning when it reaches the end of the list. If it is in a timer then it will cycle continuously. If there are three items in the list then SelectedIndex will cycle as 0, 1, 2, 0, 1, 2, ...

thanks again Reverend Jim i tested the code now and its working perfectly

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.