Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Listview question

Posted on 2006-06-29
4
Medium Priority
?
219 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, CISSP
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 500 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 18

Author Comment

by:John Gates, CISSP
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 18

Author Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

963 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