Solved

Selecting an index in a ListView control

Posted on 2007-11-16
4
183 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…

680 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