Computing.Net > Forums > Programming > Scrolling Through VB Listbox Items

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Scrolling Through VB Listbox Items

Reply to Message Icon

Name: kite
Date: November 9, 2008 at 07:00:47 Pacific
OS: Windows XP
CPU/Ram: Intel Core Duo 1GB
Product: Acer
Comment:

I have 'Up' and 'Down' buttons that I want to use to be able to scroll through the items in a listbox.
When the currently selected item is at the top, the 'Up' button is disabled. I've done this by writing:

If Listbox1.SelectedIndex = 0 Then

btnUp.Enabled = False

This works.

When the user has selected the last item in the listbox, the 'Down' button should disable. I have used the code:

If Listbox1.SelectedIndex = listIndex - 1 Then

btnDown.Enabled = False

End If

The button doesn't seem to disable.

I'm just looking for a few tips on how to be able to scroll through all of the listbox items and to get the Up and Down buttons to work properly.
I've used the method ListIndex but it tells me it isnt a member of:
Windows.System.Form.Listbox

Can anybody give me a few pointers to help me?

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: StuartS
Date: November 9, 2008 at 11:03:07 Pacific
Reply:

Try

If Listbox1.SelectedIndex = Listbox1.listIndex - 1 Then

Stuart


0

Response Number 2
Name: Razor2.3
Date: November 9, 2008 at 11:35:53 Pacific
Reply:
0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Scrolling Through VB Listbox Items

using shell through VB www.computing.net/answers/programming/using-shell-through-vb/9065.html

VB listboxes www.computing.net/answers/programming/vb-listboxes/12307.html

vb+listbox www.computing.net/answers/programming/vblistbox/2060.html