Results 1 to 3 of 3

Thread: Listview question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    Winnipeg, Manitoba Canada
    Posts
    96

    Listview question

    When I load a listview with a collection, I know how many rows there are, but when I select the row, how do I know which index is selected?

    For example, I have 5 rows. I select a row and I want to get the list index so that I can tell if it is the first or last item in the list.
    Doesn't take a rocket applicance

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Use this :
    VB Code:
    1. Dim i As Integer
    2.         For i = 0 To ListView1.Items.Count - 1
    3.             If ListView1.Items(i).Selected = True Then
    4.                 MsgBox(ListView1.SelectedItems(0).Index)
    5.             End If
    6.         Next

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    Winnipeg, Manitoba Canada
    Posts
    96
    Great !
    Thanks for the help!
    Doesn't take a rocket applicance

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