468,740 Members | 2,022 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,740 developers. It's quick & easy.

ListView problem

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
4 5031
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

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
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

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.

Similar topics

reply views Thread by Steph. | last post: by
reply views Thread by Sérgio Almeida | last post: by
3 posts views Thread by MikeY | last post: by
4 posts views Thread by firefox | last post: by
3 posts views Thread by Martin Panggabean | last post: by
12 posts views Thread by garyusenet | last post: by
4 posts views Thread by Brian Gaze | last post: by
2 posts views Thread by =?Utf-8?B?UGhpbGlw?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.