Jump to first selected item in ListBox control

S

scartin

Hi,

I have a multi-select ListBox that shows 5 rows at a time, but contains
possibly a hundred or more items. As I retrieve relevant data from
the database, I set the SelectedIndex of the rows matching the value
for the current entry, and those show up as selected in the ListBox
without any problems.

However it is entirely possible, even likely, that the first selected
index in the ListBox will not be in the first several items in the
ListBox. I've looked around for some way to automatically scroll the
ListBox to the first selected item in the array so that the user can
immediately see that an item is populated without having to scroll
through the list, but I haven't found examples of anything that
accomplishes this goal.

If anyone has any ideas regarding how to achieve this result, I would
greatly appreciate it.

Thanks,
Simon Cartin
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top