473,320 Members | 2,133 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,320 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
Nov 21 '05 #1
1 1433
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

Nov 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: don | last post by:
Ref Dvd Title Location ---------------------------------------- 62 Pilates; Austin Binder 1 63 Yoga; Kripalu Binder 1 64 Yoga; Workout ...
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: Hashim Ismail | last post by:
Hi; I am quering Active Directory and putting the results of users in the listbox. Then the user can click on the listbox which should populate the textboxes with the fields from AD, which works...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.