[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need help with EnsureVisible - it does not work with a listview - so what do I use?

Posted on 2007-10-13
5
Medium Priority
?
410 Views
Last Modified: 2013-11-07
Hi

I am using VB.net 2005 with compact framework 2.0

I need to have my listview autoscroll to the last item entered. When using a listbox I have always used

        Dim i As Integer
        i = lvTree.Items.Count - 1
        lvTree.Items(i).EnsureVisible()

but it does not work for a listview. I get an error as follows:

EnsureVisible is not a member of System.Windows.Forms.ListviewItem

So what do I do to make this work in my listview?

Thanks

PBLack
0
Comment
Question by:PBLack
  • 3
5 Comments
 
LVL 48

Expert Comment

by:jpaulino
ID: 20071091
Try

lvTree.Items(i).Selected = True

jpaulino
0
 

Author Comment

by:PBLack
ID: 20071113
Hi jpaulino

It does not work. It selects it but it is not visible. I still have to scroll to it.

PBLack
0
 
LVL 48

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 20071119
Hi PBLack,

You can use this....

    ListView1.EnsureVisible(i)

Regards,

Wayne
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 20071123
add this

ListView1.EnsureVisible(i)
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 20071125
Hi Wayne :-)
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

834 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