Results 1 to 5 of 5

Thread: How Do U Make A List Box Scroll Down Automatically

  1. #1
    Join Date
    Jan 2009
    Posts
    19

    How Do U Make A List Box Scroll Down Automatically

    Hello,
    I am looking for this all over the internet.
    How Do U Make A List Box Scroll Down Automatically?

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How Do U Make A List Box Scroll Down Automatically

    You could just scroll to the bottom as items are added.


    List1.Additem "foo"
    List1.Listindex = List1.NewIndex

  3. #3
    Join Date
    Jan 2009
    Posts
    19

    Re: How Do U Make A List Box Scroll Down Automatically

    You could just scroll to the bottom as items are added.


    List1.Additem "foo"
    List1.Listindex = List1.NewIndex

    Thanks a lot. This works!

  4. #4
    Join Date
    May 2008
    Posts
    2,012

    Re: How Do U Make A List Box Scroll Down Automatically

    Hi,
    This can very easily be achieved if you're using VB.NET. Here's an example:

    1. I have a list box named lstBox. It's got a couple of items added to it beforehand. I add a new item:
    lstBox.Items.Add ( "NewItem" )

    2. Now the number of items in a listbox is returned if you call the Count method of ListBox.Items. So:
    lstBox.Items.Count - will give me the total item count including the newly inserted item.

    3. Now third step is to select the last item - which can be achieved by using the SelectedIndex method of Listbox. SelectedIndex accepts an integer as it's parameter to indicate which item to select. Keep in mind, that this index is ZERO based. So the indices of the items in the list, start from 0 ..upto.. (n-1), where n = lstBox.Items.Count

    So all I need to do is, lstBox.SelectedIndex = lstBox.Items.Count - 1 - this single line will do the trick
    Hope this helps...
    Regards,

  5. #5
    Join Date
    Oct 2010
    Location
    Augusta, GA
    Posts
    1

    Re: How Do U Make A List Box Scroll Down Automatically

    If you don't want to have to select an item in the ListBox, you can change the TopIndex property -> it returns or sets the index of the first item visible at the top.
    I had to use this today - because I was using the SelectedIndexChanged event to run some code that went to another screen - I needed the Listbox scroll position to bethe same when the user returns to it - without having to select an item.

Similar Threads

  1. Replies: 0
    Last Post: 10-06-2013, 05:39 PM
  2. Contact list clean-up automatically in Messenger Plus!
    By Chitti's in forum Technology & Internet
    Replies: 3
    Last Post: 20-01-2012, 12:25 AM
  3. Replies: 9
    Last Post: 06-09-2011, 10:22 AM
  4. Function to automatically list in excel sheet
    By Rajani^kanta in forum Windows Software
    Replies: 3
    Last Post: 01-02-2011, 05:57 PM
  5. Make Web Pages Reload Automatically Every Few Seconds
    By Kraker999 in forum Tips & Tweaks
    Replies: 3
    Last Post: 24-03-2009, 05:52 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,449,095.74458 seconds with 16 queries