Results 1 to 4 of 4

Thread: listview help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2012
    Posts
    137

    listview help

    how do i go around doing this with listview

    If List2.ListIndex = List2.ListCount - 1 Then
    List2.ListIndex = 0
    Else
    List2.ListIndex = List2.ListIndex + 1
    End If


    please help need this done with listview


    2: i need code so if listview lastitem is selected go to first item again
    Last edited by bogaa; Nov 19th, 2012 at 10:25 PM.

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: listview help

    Is this what you want?

    vb Code:
    1. Private Sub listview1_ItemClick(ByVal Item As MSComctlLib.ListItem)
    2.     For x = 1 To ListView1.ListItems.Count
    3.      If x = x - 1 Then
    4.      ListView1.ListItems.Item(0).Selected = True
    5.      Else
    6.       ListView1.ListItems.Item(1).Selected = True
    7.     End If
    8.     Next
    9.   End Sub
    Last edited by Nightwalker83; Nov 20th, 2012 at 02:53 AM. Reason: Fixed spelling!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: listview help

    If memory serves Listview starts with an index of 1 rather than 0 so the -1 is not needed at the first item would be at index 1 instead of 0

    2 threads on basically the same question and it would appear that you have not even tried to do it yourself.

  4. #4
    Junior Member
    Join Date
    Nov 2012
    Posts
    29

    Re: listview help

    Point 2.

    use this code
    Code:
    Private Sub ListView1_Click()
    If ListView1.ListItems.Item(ListView1.ListItems.Count).Selected = True Then ListView1.ListItems.Item(1).Selected = True
    End Sub

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