Listbox selecteditem - newbie question

B

Bill Nguyen

I created a simple listbox with 2 values in a VB.NET app. When I click on
the up/down arrow to chage the value, selectedItem/selectedIndex value
doesn't change until I click on the text portion to activate it (the
selecteditem text turns blue). Is there any way to get around this extra
clicking?
Thanks
Bill
 
H

Hal Rosser

1. Have one item (the most popular) already selected. or
2. Use radio buttons.
3. Use combo box with most often chosen - already selected
 
B

Bill Nguyen

Scott & Hall
IT's a scrollbar as you put it :)

Anyway, I think I found the solution by using the TopIndex property to
identify the displaying item's index.

lbProdClass.SetSelected(lbProdClass.TopIndex, True)


p = lbProdClass.SelectedItem.ToString

MsgBox("Product Class selected: " & p)


Thanks again.
Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top