Solved

ListView Object

Posted on 2002-06-16
4
199 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
ID: 7081354
Try this

Dim i As Integer

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



hongjun
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 50 total points
ID: 7081412
to select last item in the list view

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

Expert Comment

by:Vinda
ID: 7087502
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
ID: 7098691
Vadimka, any reply?

hongjun
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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

860 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