Listbox Scroll


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Listbox Scroll

  1. #1
    Join Date
    Aug 2006
    Posts
    3

    Question Listbox Scroll

    Hello and thanks in advance for any who respond to my question.

    The default llistbox behavior seems to be to add a vertical scroll bar automatically whenever the number of items exceeds the listbox size.

    This is fine, however I would like to see the most recently added element, which I can't do unless I manually scroll down.

    Is there a way to automatically scroll down when a new item is added to the listbox?

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Try this:

    lstBox.AddItem "Item"
    lstBox.ListIndex = lstBox.NewIndex
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Aug 2006
    Posts
    3
    Thanks Phil. Is there any way to do this in the event that a new item is added? In other words, can I capture the event that something new was added to the listbox and then do list1.listendex = newindex?

    finding every instance where I do list1.additem will be difficult as it is spread throughout the program in different modules. Thanks again.

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    I don't think adding an item raises an event. I would probably create a helper function to add an item and set the ListIndex, then do a search for AddItem and replace it with a call to the helper function.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Aug 2006
    Posts
    3
    OK will do. Thanks again.

Similar Threads

  1. Replies: 0
    Last Post: 07-06-2006, 09:47 AM
  2. how to bind the listbox and textbox
    By JenHu in forum .NET
    Replies: 1
    Last Post: 06-12-2006, 07:34 PM
  3. Replies: 0
    Last Post: 04-19-2005, 04:26 PM
  4. Script for scrolling
    By Mark in forum Web
    Replies: 3
    Last Post: 08-30-2001, 11:45 AM
  5. ListBox API
    By Steve J Golem in forum VB Classic
    Replies: 0
    Last Post: 12-09-2000, 09:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center