Solved

Listview question

Posted on 2006-06-29
4
208 Views
Last Modified: 2010-04-23
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-
0
Comment
Question by:John Gates
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 125 total points
ID: 17009996
To get the next item in the list, you can do (taking into consideration that you should check that you're not currently on the last item!):

        ListView1.Items(ListView1.SelectedItems.Item(0).Index + 1)
0
 
LVL 17

Author Comment

by:John Gates
ID: 17010083
How would you check if you were at the last item>?
0
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 17010318
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
0
 
LVL 17

Author Comment

by:John Gates
ID: 17010948
Thank you for your help 8)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question