Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Selecting an index in a ListView control

Posted on 2007-11-16
4
Medium Priority
?
197 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:Murray Brown
[X]
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
  • 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:Murray Brown
ID: 20297360
Hi I need that for a LIstView, not a listbox
0
 
LVL 5

Accepted Solution

by:
pavaneeshkumar earned 2000 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:Murray Brown
ID: 31409520
Great answer. Thank you
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

722 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