Solved

Listview question

Posted on 2006-06-29
4
207 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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 …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 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