Results 1 to 3 of 3

Thread: [RESOLVED] Auto scroll to bottom of Combobox?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    Manchester, UK
    Posts
    180

    Resolved [RESOLVED] Auto scroll to bottom of Combobox?

    I have a form with a combobox which is populated at form load. The vertical scrollbar which appears when the list is too long to show all items is showing the topmost (earliest added items) and the latest added items have to be scrolled to see them.

    Is there an easy way to have the combobox scrollbar automatically scroll to its fullest on form load so that the latest entries (bottom of the list) will be visible in the combobox?


    "And then one day you find, ten years have got behind you.
    No one told you when to run, you missed the starting gun."

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Auto scroll to bottom of Combobox?

    Default behavior is that the combobox scroll's to show the selected item.

    If you wish to modify the height of the dropdown box, look at this thread

    If you still wish to scroll to the bottom you have two choices
    1) Set the ListIndex = ListCount-1, but that will change the user's selection and not user-friendly
    2) In the combo's DropDown event, locate the actual dropdown window via FindWindow API (a separate window and is not the combobox hWnd). Then send it a WM_VScroll message with the SB_Bottom flag to force scroll bar to bottom.

    Edited: Another option is to add your combobox items in reverse order, newest at the top?
    Last edited by LaVolpe; Jan 4th, 2010 at 11:33 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2008
    Location
    Manchester, UK
    Posts
    180

    Re: Auto scroll to bottom of Combobox?

    I set the ListIndex to ListCount-1.

    It works for me in my case because I have added it just before the program adds some text to the text window of the combobox before the user has input. So the user sees the list scrolled to the bottom.

    Thanks LaVolpe


    "And then one day you find, ten years have got behind you.
    No one told you when to run, you missed the starting gun."

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