VB.NET - Scroll to listview selected index - Asked By mark van on 18-Apr-06 11:31 AM

My users search for an item in a listview with a text field and search button.  It works, but how do I get the listview to scroll down to the selected index? Thanks.

Scroll to Listview selected index - Asked By Ramya T on 18-Apr-06 12:14 PM

Check this one:


Thanks a ton, R - Asked By mark van on 18-Apr-06 12:46 PM

I tried .focused before and it didn't work, but that .ensurevisible worked like a charm.  Thanks again.  Here's my code if anyone needs it.

For n = 0 To lstview.Items.Count - 1
                If CInt(TxtSearch.Text) = lstview.Items(n).SubItems(1).Text Then
                    lstview.Items(n).Selected = True
                End If

Thanks Ramya and Mark - William L replied to mark van on 14-Jun-07 12:39 PM

You don't know how many weeks I've been at this to ensure the friggin listview item is not only selected and focused, but scrolled down properly. The ensurevisible method works like a charm. Thank you thank you thank you. Did I mention THANK YOU yet?!!!?!?!?!

erion pc replied to William L on 28-Oct-10 05:53 AM
Hello, I'm having the same issue. What I don't understand is that EnsureVisible is not a property of ListViewItem!! Are you guys speaking about an asp:ListView?