473,748 Members | 3,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Set Selected Index for Listview

Is there a way to set a selected index for a Listview in a WinForms
application?

Thanks in advance,
Steve Murphy

Nov 16 '05 #1
4 50946
Steve Murphy wrote:
Is there a way to set a selected index for a Listview in a WinForms
application?

Thanks in advance,
Steve Murphy


ListView1.Items[<***YourIndex** *>].Selected = true;

Good luck,
Andrey
Nov 16 '05 #2
Steve,

Are you asking about the items collection? If you are you can do something
like:

listView1.Items[1].Selected = true;

If this is not what you are asking about please repost with more specific
details.

Hope this helps.
Nov 16 '05 #3
ListView1.Items[<***YourIndex** *>].Selected = true;


Thanks. That has helped. I don't know why I was overlooking that in the
docs.

Steve Murphy
Nov 16 '05 #4

"Brian Brown" <Br********@dis cussions.micros oft.com> wrote:
Are you asking about the items collection? If you are you can do something like:

listView1.Items[1].Selected = true;

If this is not what you are asking about please repost with more specific
details.

Thanks. That did the trick. As I said to Andrey, I don't know how I
overlooked it the docs.

Anyway, I've pretty much got what I want working.

Thanks again,
Steve Murphy
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8687
by: Sam Johnson | last post by:
H how can I SET the selected item in a listview control Thank Sam
7
24114
by: GTi | last post by:
I have a listview that with selected items. But I want to "reselect" items after a refresh. Each items have a uniqe value in the Tag object. After a refresh some new items may be added or removed so using item index is not possible. To get the list of selected items I use: ListView.SelectedListViewItemCollection selItems = this.listView1.SelectedItems;
3
2454
by: Steve | last post by:
I can't seem to get howto find the index of the selected item in a listview (View.Details).... Thanks in advance, steve
2
1628
by: StriderBob | last post by:
In a list box, lbox1.SetSelected(0, True) or lbox1.SelectedIndex = 0 all work fine but how do you set the selected line in a ListView, is it possible? The ListView is being used in Details-View mode, in each line the first item is a line No. (1 - 150 in this instance). I can get an index no for a line I select with the mouse but cannot find a way to programatically select a line (Specifically, for example, either select item 10 or...
1
4265
by: LagartijaNick | last post by:
Question: I have a ListView in which I'm selecting a ListViewItem based on the value of a textbox. On my XP machine (with default color scheme) the ..Selected row is a noticable grey (back color of ListView is white). However, on a custom Win2K desktop, the selected item is a faint grey and the users can barely see the highlighted row. The custom desktop settings have been locked down (ie. cannot be changed via Control Panel etc.)
6
22172
by: George | last post by:
Hi all, How can I get the value stored from the selected item and subitems of a listview? Thanks in advance, George
3
3608
by: Tiago Salgado | last post by:
I everyone... I've got a listview (details) ... and i'm trying to unselect any item selected... In a combobox, e.g, i can put this: ComboBox1.SelectedIndex = -1 I want to do this but in a listview control... can anyone help me? Thanks
2
2319
by: forest demon | last post by:
in a different app, i can grab the index of a ListBox, but when i try it with a listview with only one column, i'm having issues. the first line (string) below works as expected. the second line (string), i want the index of the fField arraylist. i just have a 0 in there at this point...i would think there is something similar to indexing a listbox, such as lvProductSelection.SelectedIndex
2
8067
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, I'm trying to get the index of a selected Item in ListView. I'm using the SelectedItemChange Event, but i can't get the item index (like in listbox for i.e). How can i get the index? Thanks, Gidi
0
3311
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. Provide following view properties to listview, through View menu a. Tile b. Icon
0
8989
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.