Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Selecting an index in a ListView control

Posted on 2007-11-16
4
182 Views
Last Modified: 2013-11-26
Hi

How do you set the selected index of a ListView control?

The equivalent code for a ListBox in VBA would be
Me.lsbActionR.ListIndex = 10
0
Comment
Question by:murbro
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:pavaneeshkumar
ID: 20297057
use following to set the list index
ListBox1.SelectedListIndex=10

Open in new window

0
 

Author Comment

by:murbro
ID: 20297360
Hi I need that for a LIstView, not a listbox
0
 
LVL 5

Accepted Solution

by:
pavaneeshkumar earned 500 total points
ID: 20297435
for listview it will change as follows
listView1.Items[indextoselect].Selected = true;
or
listView1.Items[10].Selected = true;

Open in new window

0
 

Author Closing Comment

by:murbro
ID: 31409520
Great answer. Thank you
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 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