Selecting correct index in listbox

D

don

Ref Dvd Title Location
----------------------------------------
62 Pilates; Austin Binder 1
63 Yoga; Kripalu Binder 1
64 Yoga; Workout Binder 1
93 The Sopranos Binder 1
94 The Sopranos Binder 2
95 The Sopranos Binder 3


Programming in ASP.net in VB, I'm trying to return the Location element
from this dataset. I'm binding the 'Dvd Title' collumn to a listbox, and
using the selected index value to determine which row to return the
'Location' element from. It binds just fine, and as I scroll down the list
and select each title, all of the titles are there. But the SelectedIndex
value is the same whether I pick the first, second, or third Sopranos row.
If the first Sopranos is at index 54, then all three Sopranos return 54 for
the SelectedIndex value.


This is the code I use inside of a SelectedIndexChanged event:


Me.BinderTextBox.Text =
LocalDS.Movies.Rows(TitlesListBox.SelectedIndex).Item("Location")


The .Net Framework help screens describes the SelectedIndex as "Gets or
sets the lowest ordinal index of the selected items in the list."

Not being a master of english language, I'm confused by the term 'ordinal
index'. But by the way my code is reacting, I think it means something like
'return the lowest occurance of".

Is there a different way to get the actual index of the second and third
selections of Sopranos?

Thanks,
Don
 
D

don

I found that by binding the value value field to the primary key (the ref
collumn) that the listbox would then return unique indexs for nonunique
titles.

d
 

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