Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Get selected values in ListBox with multiple selectionmode property

Reply
Thread Tools

Get selected values in ListBox with multiple selectionmode property

 
 
Matthew Louden
Guest
Posts: n/a
 
      11-13-2003
I created a listbox with multiple selectionmode property, but I have trouble
to get a list of selected values.

The following only gets the first selected value, not others.

TextBox2.Text = ListBox1.SelectedValue

Please help!!
Thanks


 
Reply With Quote
 
 
 
 
Hero Ngan
Guest
Posts: n/a
 
      11-13-2003
I think you can use a For-Loop to loop the listbox, then check the item is
selected or not.

Roughly code:

' loop the ListBox items
For iLoop = 0 To ListBox1.Items.Count - 1
' item selected
If ListBox1.Items(iLoop).Selected Then
TextBox2.Text = TextBox2.Text & ListBox1.Items(iLoop).Value & ";"
End If
Next

Hope can help you!

Rdgs,
Hero Ngan


"Matthew Louden" <(E-Mail Removed)> glsD
:(E-Mail Removed)...
> I created a listbox with multiple selectionmode property, but I have

trouble
> to get a list of selected values.
>
> The following only gets the first selected value, not others.
>
> TextBox2.Text = ListBox1.SelectedValue
>
> Please help!!
> Thanks
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
using a ListBox with SelectionMode="Multiple" in a linq query Seb ASP .Net 0 05-12-2008 08:08 PM
Bind data in a ListBox with multiple selectionmode Fabio Visin ASP .Net 3 02-21-2008 09:33 AM
Listbox move multiple selected items to second listbox K B ASP .Net 2 01-08-2007 11:16 AM
Calendar SelectionMode david.decotis@sitq.com ASP .Net Web Controls 0 05-30-2006 08:24 PM
Get selected values in ListBox with multiple selectionmode property Matthew Louden ASP .Net 1 11-13-2003 02:30 AM



Advertisments