By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,068 Members | 1,006 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,068 IT Pros & Developers. It's quick & easy.

ListView problem

P: n/a
Hello,

Anyone know how to scroll down the listview by code?
Eg. I have 200 items in the listview. When I set the selectedItem to be
item 180, the user cannot see it if he don't scroll it down.

Thanks!
Nov 15 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Use the EnsureVisible method. Pass in the index of the item you want to
scroll into view.
--
____________________
Klaus H. Probst, MVP
http://www.vbbox.com/

"alan" <ab*@hotmail.com> wrote in message
news:u%****************@TK2MSFTNGP11.phx.gbl...
Hello,

Anyone know how to scroll down the listview by code?
Eg. I have 200 items in the listview. When I set the selectedItem to be item 180, the user cannot see it if he don't scroll it down.

Thanks!

Nov 15 '05 #2

P: n/a

Hi Alan,

Thanks for posting in this group.
You can use ListView.EnsureVisible method to force listview auto scroll to
your wanted item.

If the item that you want to ensure is visible is located above the
viewable region of the ListView control, calling the EnsureVisible method
will scroll the contents of the control until it is the first item in the
viewable area of the control. If the item is below the viewable region of
the ListView control, calling the EnsureVisible method will scroll the
contents of the ListView control until the item is the last item in the
viewable area of the control.

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #3

P: n/a
Use the EnsureVisible method. Pass in the index of the item you want to
scroll into view.
--
____________________
Klaus H. Probst, MVP
http://www.vbbox.com/

"alan" <ab*@hotmail.com> wrote in message
news:u%****************@TK2MSFTNGP11.phx.gbl...
Hello,

Anyone know how to scroll down the listview by code?
Eg. I have 200 items in the listview. When I set the selectedItem to be item 180, the user cannot see it if he don't scroll it down.

Thanks!

Nov 15 '05 #4

P: n/a

Hi Alan,

Thanks for posting in this group.
You can use ListView.EnsureVisible method to force listview auto scroll to
your wanted item.

If the item that you want to ensure is visible is located above the
viewable region of the ListView control, calling the EnsureVisible method
will scroll the contents of the control until it is the first item in the
viewable area of the control. If the item is below the viewable region of
the ListView control, calling the EnsureVisible method will scroll the
contents of the ListView control until the item is the last item in the
viewable area of the control.

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.