473,396 Members | 2,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Selecting correct index in listbox

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).I tem("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
Jul 21 '05 #1
1 1445
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

"don" <wo********@yahoo.com> wrote in message
news:lf********************@comcast.com...

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).I tem("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

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeffrey Barish | last post by:
I have an application that produces two listboxes. I would like to be able to select one of the items in the first listbox and one of the items in the second listbox. However, when I make my...
1
by: Alvey Sidecast | last post by:
This is probably embarrassingly simple, but I've been trawling through this ng for hours now and my brain hurts. I've got an unbound multi-column listbox (multi-select=none) whose rowsource is a...
1
by: Bob Geltz | last post by:
I am able to populate a ListView with several detail lines (several columns). When finished, I would like to pre-select the first item in the list (before the user interacts with the list). This...
4
by: Ron | last post by:
I've got a listbox that holds a list of groups. Users can select a group, hit the remove button and the group should be removed from the listbox. The only problem is that no matter which group you...
6
by: Niggy | last post by:
Hi there, I would like to display the values of the index as chosen by the user in a listbox. These values would be as per the datavaluefield. On testing I get a value of -1: Private Sub...
10
by: Adam Clauss | last post by:
I have a page containing a list box. This list may contain duplicate items - in which the ORDER is important. ex: a b b a is significant as compared to: b
1
by: don | last post by:
Ref Dvd Title Location ---------------------------------------- 62 Pilates; Austin Binder 1 63 Yoga; Kripalu Binder 1 64 Yoga; Workout ...
3
by: joshsackett | last post by:
I am having a problem with indexes on specific tables. For some reason a query that runs against a view is not selecting the correct index on a table. I run the same query against the table...
3
by: Kevin Walzer | last post by:
I'm trying to set the active item in a Tkinter listbox to my application's currently-defined default font. Here's how I get the fonts loaded into the listbox: ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.