How can I get all values of a ListBox(Multiple selection is ON)
-
Hi; I've a list box named "listUsers". User can select multiple vales. How can I get the values of all the fields selected? Waiting for reply.....:(( ------------------------- M. Mohsin Ali Freelance .NET Developer and HTML Integrator
Hi there. You can loop through all the
ListItem
objects contained in your listUsers.Items
collection, and test theSelected
property of each. -
Hi there. You can loop through all the
ListItem
objects contained in your listUsers.Items
collection, and test theSelected
property of each. -
How can I check the selected property? Can u plz give me a code snippet to do this. Mohsin Ali
Hi there. It's not that tough - make sure to look at the MSDN documentation on ListBox... it could go something like this -
foreach (ListItem item in myListBox.Items)
{
if (item.Selected == true)
{
//... do something for the selected item...
}
}