473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

View selected item in listView

I select an item in a listView by code and it works fine (thanks to Morten
Wennevik who tell me how to do it) but if the item is out of screen (there
are a lot of items) I'd like to see it selected. Actually, the item is
selected but I can't see because is out of screen.

Thank you.
Nov 16 '05 #1
2 4360
Take a look at the ListView.EnsureVisible method.

ShaneB
"Alberto" <al*****@nospam.com> wrote in message
news:uf**************@TK2MSFTNGP10.phx.gbl...
I select an item in a listView by code and it works fine (thanks to Morten
Wennevik who tell me how to do it) but if the item is out of screen (there
are a lot of items) I'd like to see it selected. Actually, the item is
selected but I can't see because is out of screen.

Thank you.

Nov 16 '05 #2
Hi Alberto,

Add EnsureVisible(lst.FocusedItem.Index); to each key in the switch.

....
lst.EnsureVisible(lst.FocusedItem.Index);
e.Handled = true;
break;
....

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3

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

Similar topics

7
by: Jax | last post by:
I understand that it's supposed to contain text, usually. But as it takes an object can you be really cheeky and put a very complex object in there instead? Would any problems come from doing...
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...
5
by: Praveen R | last post by:
Hi ! I am using a List view control to populate data onto. On the click event of the list view control, i need to find out whether the area clicked has any information of has no information. I...
5
by: Darin | last post by:
I have a listview box in detail view with 100+ items. I can select the 50th item by lstdetail.items(49).selected=true. But, when I do that the item is selected, but the listview box hasn't scrolled...
3
by: Darin | last post by:
See Code: Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim oListView As New ListView Dim oItem As ListViewItem Dim cnt As Integer Dim msg As...
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
6
by: Brad Pears | last post by:
As part of my vb.net 2005 application I would like to automatically select the very first item (index 0) in a listview containing menu items. That way the the listviews "afterselect" event would...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...
0
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...

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.