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

Get selected values in ListBox with multiple selectionmode property

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
Nov 17 '05 #1
1 8167
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" <ma*******@hotmail.com> ¼¶¼g©ó¶l¥ó·s»D
:e4**************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #2

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

Similar topics

8
by: Vipin Kedia | last post by:
Hi I have written a code for showing the list boxes as selected using a Listitem and the selected property of the items. Now I have 2 list boxes in my page. But it shows only the selected values...
1
by: | last post by:
Hello everybody... How can i unplug selected item in Listbox. Thanks in advance. Paulo
2
by: David | last post by:
I have a problem with the Listbox Web control in C#. It works fine in VB but in C#, the .Selected property always returns false for some reason. I have the Listbox Selectionmode set to Multiple. ...
1
by: Raymond | last post by:
I have a WebForm with a ListBox in it. This SelectionMode is set to Multiple. When a button is clicked, I check what items are selected using: foreach (ListItem itm in lb.Items) {...
3
by: Big E | last post by:
I'm using ASP.Net and SQL Server. I have a listbox looks up data from a table and fills the listbox. I have a stored procedure that looks up the selected values and tries to show them as selected...
5
by: Paul | last post by:
Hi I have a listbox and have the selection mode set to multiple in the property box. I am trying to set multiple selected values in code but it only seems to use the last one....
3
by: David L Wright II | last post by:
I have a data bound listbox that I want to select multiple lines then process each line. I bound a two column datatable to the listbox and set the DisplayMember property to the appropriate column...
2
by: Greg | last post by:
I have a listbox inside of a DetailsView. There are three departments to choose from, Corporate, Group, Vacation. The listbox is set to SelectionMode="multiple". I think I have this loop setup...
0
by: waldedg | last post by:
I have a ListBox set as Multiselect. I am populating the table thruough asp.net code. But I am using another dataset to get the items that should be selected. The only item that ends up selected is...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.