Solved

ListView Object

Posted on 2002-06-16
4
197 Views
Last Modified: 2010-05-02
ListView obect display a number of records.
how can i select ,for example last record ,in the program
(without mouse or keyboard)
I can't find any method which can do it in the listview.
Thanks .
0
Comment
Question by:Vadimka
  • 2
4 Comments
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
Try this

Dim i As Integer

i = 2 ' 2 means second record
ListView1.ListItems(i).Selected = True



hongjun
0
 
LVL 22

Accepted Solution

by:
mnasman earned 50 total points
Comment Utility
to select last item in the list view

  ListView1.ListItems(ListView1.ListItems.Count).Selected = True
  ListView1.SetFocus
0
 
LVL 1

Expert Comment

by:Vinda
Comment Utility
lIndex = ListView1.ListItems.Count

ListView1.ListItems(lIndex).Selected = True
ListView1.ListItems(lIndex).EnsureVisible

This should solve the problem
0
 
LVL 33

Expert Comment

by:hongjun
Comment Utility
Vadimka, any reply?

hongjun
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now