ListView problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • alan

    #1

    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!


  • Klaus H. Probst

    #2
    Re: ListView problem

    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" <abc@hotmail.co m> wrote in message
    news:u%23afbUhu DHA.3256@TK2MSF TNGP11.phx.gbl. ..[color=blue]
    > 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[/color]
    be[color=blue]
    > item 180, the user cannot see it if he don't scroll it down.
    >
    > Thanks!
    >
    >[/color]


    Comment

    • Jeffrey Tan[MSFT]

      #3
      RE: ListView problem


      Hi Alan,

      Thanks for posting in this group.
      You can use ListView.Ensure Visible 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.

      Comment

      • Klaus H. Probst

        #4
        Re: ListView problem

        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" <abc@hotmail.co m> wrote in message
        news:u%23afbUhu DHA.3256@TK2MSF TNGP11.phx.gbl. ..[color=blue]
        > 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[/color]
        be[color=blue]
        > item 180, the user cannot see it if he don't scroll it down.
        >
        > Thanks!
        >
        >[/color]


        Comment

        • Jeffrey Tan[MSFT]

          #5
          RE: ListView problem


          Hi Alan,

          Thanks for posting in this group.
          You can use ListView.Ensure Visible 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.

          Comment

          Working...