Auto scroll listbox in VB.net

VB.net: Auto Scroll a Listbox

Do you want to make a Listbox in VB.net auto scroll to the last value?
I use this to log and show the progress of what my application is currently doing.

Amazingly ugly UI I made.
Auto scroll listbox in VB.net

The first line just add date and the current time to the Listbox.
The second line is the one that actually scroll the Listbox.
The third line is refreshing the UI which might be needed if your application need to do a lot of work…

ListBox.Items.Add(DateTime.Now)
ListBox.TopIndex = ListBox.Items.Count - 1
Refresh()

A good idea is to use a timer to keep the Listbox scrolling so you don’t have to add the same code over and over each time you add a new item to the Listbox.

Published by

Webmaster

I'm a guy, born and raised in Scandinavia, around 40 years old and have worked self-employed as a webmaster in lots of different fields, niches, doing all kind of work online.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.