I have 1 list view with 3 items in it, and a command button. When you click the command button, i want the next item in the list view to be selected. How do i do that?
:confused:
Printable View
I have 1 list view with 3 items in it, and a command button. When you click the command button, i want the next item in the list view to be selected. How do i do that?
:confused:
here:
VB Code:
Private Sub Command1_Click() If Not List1.ListIndex = List1.ListCount - 1 Then List1.ListIndex = List1.ListIndex + 1 End If End Sub
Actually, this is for a ListBox control, if you're using a ListView, the code will be :
Code:
If lvw.ListItems.Count > lwv.SelectedItem.Index + 1 then
lvw.ListItems(lvw.SelectedItem.Index + 1).Selected = 1
end if
I made a mistake :
Code:
If lvw.ListItems.Count >= lwv.SelectedItem.Index + 1 then
lvw.ListItems(lvw.SelectedItem.Index + 1).Selected = 1
end if
unless the LAST item is selected. does this need to wrap around to the beginning?