Link to home
Start Free TrialLog in
Avatar of John Gates, CISSP, CDPSE
John Gates, CISSP, CDPSEFlag for United States of America

asked on

Listview question

I am having problems with what I think should be a simple thing to figure out..  Anyway I would like to view the record below a selected list view item for comparison.
I know for the selected item it is:

ListView1.SelectedItems.Item(0).ToString()

but how could you read the item(s) on the line below as well?

Thanks in advance!
-D-
ASKER CERTIFIED SOLUTION
Avatar of ZeonFlash
ZeonFlash

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John Gates, CISSP, CDPSE

ASKER

How would you check if you were at the last item>?
Avatar of ZeonFlash
ZeonFlash

To check that, you need to check the index of the current item against the total number of items in the list:

       Dim objItem As Object

        If ListView1.SelectedItems.Item(0).Index <> ListView1.Items.Count - 1 Then
            objItem = ListView1.Items(ListView1.SelectedItems.Item(0).Index + 1)
        Else
            MsgBox("You are at the last item")
        End If
Thank you for your help 8)