473,472 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Set selected item in listview

H

how can I SET the selected item in a listview control

Thank
Sam
Jul 21 '05 #1
2 8660
ListView.Items(index).Selected=true;

Note: By default, ListView.HideSelection is set True, so unless the listview
has focus, the selected ListViewItem is not highlighted.

"Sam Johnson" <an*******@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
Hi

how can I SET the selected item in a listview control?
Thanks
Sam

Jul 21 '05 #2
LucasQ
1 New Member
It can be also useful if you add this line after selecting the item:
ListView.Items(index).EnsureVisible();

This will scroll the ListView (if necessary) to show selected item.
Sep 27 '05 #3

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

Similar topics

7
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...
7
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I'v been struggeling with removing selected items from a listview. Anyone that can give me a piece of code that does this? I am a newbee to this C# and cant figure it out.... Regards...
2
by: billyb | last post by:
My listview has two columns: Email Address & Email Address Type. I've figured out how to populate it, but now I'm having trouble figuring out how to properly use the SelectedItems to get at the...
2
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...
1
by: Sam Johnson | last post by:
H how can I SET the selected item in a listview control Thank Sam
6
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
7
by: Mike Johnson | last post by:
How do I remove a item that's been selected from a listview? I'm using Visual Basic 2005 express edition. Thanks
4
by: Bill-R | last post by:
I'm trying to convert a vb6 program to vb.net (vb2008 express) I have text data in a Listview Control I use a Textbox to enter characters to search the Listview When a Match is found, I use...
0
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I have a listview that when I select an item, it populates a details view. I want to show the item that was selected in the listview by changing it to yellow. Trouble is, the selected item does not...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
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...
0
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
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 ...
0
muto222
php
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.