+ Reply to Thread
Results 1 to 3 of 3

How to make listbox show the last item being added?

  1. #1
    Registered User
    Join Date
    07-21-2005
    Posts
    28

    How to make listbox show the last item being added?

    Hi!

    I have a list box in a form and it shows the running status. For example,
    many status are added to the list box as

    lstStatus.AddItem Doing action 1
    lstStatus.AddItem Doing action 2
    lstStatus.AddItem Doing action 3
    lstStatus.AddItem Doing action 4
    lstStatus.AddItem Doing action 5
    lstStatus.AddItem Doing action 6
    ...
    ...

    so on.

    As more actions are added to the list box, the list box does not automatically scroll down to show the latest one and user can only see the first few ones that fit into the height of the list box.

    My question is: how to make list box automatically scroll down to show the last item that is added to the list box.?

    Please advise.

    Aijun.

  2. #2
    Robin Hammond
    Guest

    Re: How to make listbox show the last item being added?

    Aijun,

    It should be something like

    lstStatus.AddItem "Doing action 6"
    lstStatus.Listindex = lstStatus.Listcount-1

    Robin Hammond
    www.enhanceddatasystems.com

    "Ai_Jun_Zhang" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Hi!
    >
    > I have a list box in a form and it shows the running status. For
    > example,
    > many status are added to the list box as
    >
    > lstStatus.AddItem Doing action 1
    > lstStatus.AddItem Doing action 2
    > lstStatus.AddItem Doing action 3
    > lstStatus.AddItem Doing action 4
    > lstStatus.AddItem Doing action 5
    > lstStatus.AddItem Doing action 6
    > ..
    > ..
    >
    > so on.
    >
    > As more actions are added to the list box, the list box does not
    > automatically scroll down to show the latest one and user can only see
    > the first few ones that fit into the height of the list box.
    >
    > My question is: how to make list box automatically scroll down to show
    > the last item that is added to the list box.?
    >
    > Please advise.
    >
    > Aijun.
    >
    >
    > --
    > Ai_Jun_Zhang
    > ------------------------------------------------------------------------
    > Ai_Jun_Zhang's Profile:
    > http://www.excelforum.com/member.php...o&userid=25474
    > View this thread: http://www.excelforum.com/showthread...hreadid=400178
    >




  3. #3
    Registered User
    Join Date
    07-21-2005
    Posts
    28

    Thanks, Robin.

    Robin,

    Thank you very much for the code. It works great!

    Aijun.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1