Solved

Selecting an index in a ListView control

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

17 Experts available now in Live!

Get 1:1 Help Now