473,405 Members | 2,171 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,405 software developers and data experts.

Help with listbox

Hi.

I am trying to loop thru a listbox and retreive the value for all
selected items.

Example of listbox items:
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option value="4">Item 4</option>
<option value="5">Item 5</option>

Here is an example of the code used to parse the listbox:

If Me.lstSelectedIssues.Items.Count = 0 Then Return String.Empty
For x = (Me.lstSelectedIssues.Items.Count - 1) To 0 Step -1
sBuffer += Me.lstSelectedIssues.Items(x).Value + ","
Next

I keep getting the TEXT ('Item1") instead of the NUMERIC (1) values
from these items.

What am I doing wrong?

Thanks,
Steve
Jan 12 '08 #1
2 1188
Your code looks fine. What sort of server-side control are you using for
your multi-select list box, and how are you populating it?

<gl****@gmail.comwrote in message
news:fc**********************************@k2g2000h se.googlegroups.com...
Hi.

I am trying to loop thru a listbox and retreive the value for all
selected items.

Example of listbox items:
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option value="4">Item 4</option>
<option value="5">Item 5</option>

Here is an example of the code used to parse the listbox:

If Me.lstSelectedIssues.Items.Count = 0 Then Return String.Empty
For x = (Me.lstSelectedIssues.Items.Count - 1) To 0 Step -1
sBuffer += Me.lstSelectedIssues.Items(x).Value + ","
Next

I keep getting the TEXT ('Item1") instead of the NUMERIC (1) values
from these items.

What am I doing wrong?

Thanks,
Steve
Jan 13 '08 #2
On Jan 13, 8:25*am, "Joe Chung" <jchung2...@gmail.comwrote:
Your code looks fine. *What sort of server-side control are you using for
your multi-select list box, and how are you populating it?

<glb...@gmail.comwrote in message

news:fc**********************************@k2g2000h se.googlegroups.com...
Hi.
I am trying to loop thru a listbox and retreive the value for all
selected items.
Example of listbox items:
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option value="4">Item 4</option>
<option value="5">Item 5</option>
Here is an example of the code used to parse the listbox:
If Me.lstSelectedIssues.Items.Count = 0 Then Return String.Empty
* * *For x = (Me.lstSelectedIssues.Items.Count - 1) To 0 Step -1
* * * * * *sBuffer += Me.lstSelectedIssues.Items(x).Value + ","
* * *Next
I keep getting the TEXT ('Item1") instead of the NUMERIC (1) values
from these items.
What am I doing wrong?
Thanks,
Steve- Hide quoted text -

- Show quoted text -
Thanks for responding. I am populating the box using a SQLDataSource.

Steve
Jan 13 '08 #3

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

Similar topics

1
by: Vengeance | last post by:
On the parent_form.aspx I have these controls <asp:listbox id="Operators" runat="server" Width="163px" SelectionMode="Multiple" Rows="2"></asp:listbox> <INPUT class="loButton" onclick="java...
9
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
7
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
5
by: Melissa Cowan | last post by:
I am using Access 2000. I have the Developer's handbook and got the code for the mulit select listbox from there. It sends the selected value to another listbox, lstselected. What I need to do is...
0
by: David J | last post by:
Hi, I am strugling with the propertygrid and a listbox. I am using the universaldropdowneditor from the codeproject (code below). However I am populating the listbox via a datasource. The problem...
16
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just...
15
by: deercreek | last post by:
I need some help figuring something out. I'm not sure if I heading in the correct direction. What I'm trying to accomplish is the following. I have a table that has id, discrip, and 2 date fields....
0
by: Alex | last post by:
Subject: Help with DoDragDrop event? From: Alex <me112006@test.com> Newsgroups: microsoft.public.dotnet.languages.csharp Hi all, I'm having a problem with drag/drop on listboxes... ...
2
by: Phijo | last post by:
Hello, I am writing a page (C#) that uses one ListBox that retrieves data from a DB using SqlDataSource and the SelectCommand. <asp:SqlDataSource ID="DataSource1" SelectCommandType=Text...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.