468,290 Members | 2,044 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

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 1076
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Vengeance | last post: by
7 posts views Thread by Dave Hopper | last post: by
3 posts views Thread by Paul T. Rong | last post: by
5 posts views Thread by Melissa Cowan | last post: by
15 posts views Thread by deercreek | last post: by
reply views Thread by Alex | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.