Solved

Selecting an index in a ListView control

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
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:…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

920 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

14 Experts available now in Live!

Get 1:1 Help Now