Results 1 to 5 of 5

Thread: List View

  1. #1

    Thread Starter
    Hyperactive Member StreaksAthlete's Avatar
    Join Date
    Sep 2004
    Posts
    348

    Exclamation List 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?

  2. #2
    Fanatic Member ALL's Avatar
    Join Date
    Jul 2004
    Location
    192.168.1.1
    Posts
    711
    here:
    VB Code:
    1. Private Sub Command1_Click()
    2. If Not List1.ListIndex = List1.ListCount - 1 Then
    3.   List1.ListIndex = List1.ListIndex + 1
    4. End If
    5. End Sub
    Please support one of my projects?
    TKForums.com

    Web Forum
    JavaScript Wiki
    ________________________
    If somone helps you, please rate their post, by clicking the to rate their post

  3. #3
    Fanatic Member
    Join Date
    May 2004
    Location
    Granby, Qc, Canada
    Posts
    602
    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

  4. #4
    Fanatic Member
    Join Date
    May 2004
    Location
    Granby, Qc, Canada
    Posts
    602
    I made a mistake :

    Code:
    If lvw.ListItems.Count >= lwv.SelectedItem.Index + 1 then
        lvw.ListItems(lvw.SelectedItem.Index + 1).Selected = 1
    end if

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    unless the LAST item is selected. does this need to wrap around to the beginning?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width