xZerox
xZerox

Reputation: 331

VB.net Listbox Autoscroll

Well I am trying to autoscroll my ListBox or display everything the opposite way just like a shoutbox.

Please post the code here on how to do it. I have tried many ways but they either gave me errors or didn't work.

Upvotes: 1

Views: 18829

Answers (3)

v4o
v4o

Reputation: 21

This is what I use on vb.net 2008 pro and it works for me. Just make sure you don't have it set to multi select.

Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1

Upvotes: 2

Fady Harfouch
Fady Harfouch

Reputation: 94

Man try this:

ListBox1.TopIndex = ListBox1.Items.Count - 1

It works. I always use it.

Upvotes: 2

Hans Olsson
Hans Olsson

Reputation: 55009

Just usethe ListBox.TopIndex property.

Here's the help for it:

http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.topindex.aspx

Or otherwise you could just insert the new items on the top rather than the bottom.

As a general tip though, if you're having problems getting the ListBox to do what you need, it might be worth using a ListView in details mode instead.

Upvotes: 1

Related Questions