473,854 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

List View question

I have a listview box in detail view with 100+ items. I can select the
50th item by lstdetail.items (49).selected=t rue. But, when I do that the
item is selected, but the listview box hasn't scrolled down to where
that line item is.

How do I get the listview box to scroll down to the selected items.

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #1
5 1333
Me.lsvListView. SelectedItems(0 ).EnsureVisible

"Darin" <darin_nospam@n ospamever> schreef in bericht
news:uV******** *****@TK2MSFTNG P15.phx.gbl...
I have a listview box in detail view with 100+ items. I can select the
50th item by lstdetail.items (49).selected=t rue. But, when I do that the
item is selected, but the listview box hasn't scrolled down to where
that line item is.

How do I get the listview box to scroll down to the selected items.

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #2
Darin,

The listview control has an EnsureVisible method that should do what you need.

Kerry Moorman

"Darin" wrote:
I have a listview box in detail view with 100+ items. I can select the
50th item by lstdetail.items (49).selected=t rue. But, when I do that the
item is selected, but the listview box hasn't scrolled down to where
that line item is.

How do I get the listview box to scroll down to the selected items.

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #3
"Darin" <darin_nospam@n ospamever> schrieb:
How do I get the listview box to scroll down to the selected items.


Call the item's 'EnsureVisible' method or the 'EnsureVisible' method of the
listview control.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
THanks - that worked great.

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #5
In addition to this, when the 50th element is selected, that is fine,
but the first element still has a box around it. So, if I select the
50th programmaticall y, then, when running the program, hit the down
arrow, it moves from element 1 to element 2, even though 50 was
selected.

I need to somehow completely un-select the first element.

My listview has the following properties:

Me.lstCode.Full RowSelect = True
Me.lstCode.Loca tion = New System.Drawing. Point(8, 80)
Me.lstCode.Mult iSelect = False
Me.lstCode.Name = "lstCode"
Me.lstCode.Size = New System.Drawing. Size(744, 208)
Me.lstCode.TabI ndex = 10
Me.lstCode.View = System.Windows. Forms.View.Deta ils

Darin

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #6

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

Similar topics

8
1884
by: Guy Hocking | last post by:
Hi there, I am having a few problems compiling a list box that is conditional on what is selected in another list box. What i need is a List box (lstArea) that displays one thing when the List Box (lstRegion) is selected East or West. Basically the areas will change when East or West is selected in lstRegion. The data comes from an SQL Server view, and my current non-working code is as follows, my syntax in the SQL statement is...
5
3626
by: Xah Lee | last post by:
suppose i'm going to have a data structure like this: , , , , .... ] should i use (width,height) or ?
19
13581
by: RAJASEKHAR KONDABALA | last post by:
Hi, Does anybody know what the fastest way is to "search for a value in a singly-linked list from its tail" as oposed to its head? I am talking about a non-circular singly-linked list, i.e., head and tail are not connected. Of course, recursive function aproach to traverse the list is one way. But, depending upon the list size, it could overrun the stack pretty fast.
5
2302
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 basically need to either decide to add a new record or edit the existing record depending on whether data is available or not on the row where the mouse click was performed.
0
3248
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another way... here is my code on how I did it to help anyone starting out get an idea of how to use virtual mode in ..NET 2.0 Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared
90
10859
by: Christoph Zwerschke | last post by:
Ok, the answer is easy: For historical reasons - built-in sets exist only since Python 2.4. Anyway, I was thinking about whether it would be possible and desirable to change the old behavior in future Python versions and let dict.keys() and dict.values() both return sets instead of lists. If d is a dict, code like: for x in d.keys():
15
25983
by: Andrew Brampton | last post by:
Hi, This may sound a odd question, but I wanted to know how you return a list of data from a function. These are some of the ways I know how, and I was wondering which method you normally use. This is more of a best practices question rather than a technical one. 1) Return a list instance ie std::list myFunction() { std::list list(); return list;
2
1719
by: Kaur | last post by:
Hi, I have a form Form1 that displays surveys. This form has a subform1 which displays questions related to a particular survey. This subform has a subsubform which displays subquestions for a particular question for a particular survey. I have created a combo box for questions on subform1. What I am trying to achieve is if a user wants to add a question to a particular survey, if the question is not in the list, the user should be able...
0
1156
by: anna_parkins7 | last post by:
Hi Quick question, that will point me in the right direction. I have 2 user controls on a page, both called List.ascx but obviously in 2 different namespaces and 2 different tags.. however I get the error: Compiler Error Message: CS1595: 'ASP.List_ascx' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\wms\14c775ea\f2e196aa\rkmoy7hl.dll'
1
1500
by: Jeff Williams | last post by:
With a list view is it possible and if so how to turn off the search function. What I mean is if you are in a list view and start typing it will search the first column to match or close match a value in the first column like auto complete. I dont need this to happen. if column 1 contains a series of numbers from 1 to 500. If you enter 234 while in the list view it scrolls to the row which has 234 in the first
0
9901
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
9751
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10678
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7079
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5740
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5940
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4557
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
4153
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.