Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Listview scroll bar

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    484

    Resolved [RESOLVED] [2005] Listview scroll bar

    Hi,

    How do I make the scroll bar automatically scroll down while I am busy adding data onto the listview?

    Thanks

    PlayKid

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Listview scroll bar

    listviewitems have an EnsureVisible method, that will scroll the listview to make sure that item is in view. As you add each item, call that method on the newly added item, and it will scroll with it..

    something like this
    VB Code:
    1. Dim lvi As ListViewItem = Nothing
    2.         For i As Integer = 1 To 3000
    3.             lvi = New ListViewItem("Item " & i.ToString)
    4.             ListView1.Items.Add(lvi).EnsureVisible()
    5.             Application.DoEvents()
    6.         Next

    if you are not loading your list via a loop, and you are adding them manually (like filling in textboxes and clicking a button that inserts the listviewitem into the listview) then you shouldn't need the application.doevents.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2004
    Posts
    484

    Re: [2005] Listview scroll bar

    wow....Thanks so much, I never thought there can be a function for that.

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] Listview scroll bar

    no problem. Please mark the thread resolved if you got what you needed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width