naderhadda
New Member
I'm trying to access the items selected in a listbox and loop through them. Previously when a form with such a listbox posted to a page I would just say:<BR><BR>Units = Split(Request("units"),", ")<BR><BR>and Units would become an array filled with everything the user selected on the previous page. I'm trying to do this now, and the only property for a listbox that looks useful is selectedItem. I noticed in my vb.net book that there is a selectedItems property, but that doesn't appear to be so when using a web control. Any suggestions?Here is a sub I pulled from one of my files. It uses a multi-list box and grabs the selected items with this code:<BR><BR> sub drawGraph(Sender as Object, e as EventArgs)<BR> if lbUsers.selectedIndex >= 0 then<BR> Dim li As ListItem<BR> dim strUsers as string<BR> For Each li In lbUsers.Items<BR> If li.Selected = True Then strUsers += "'" & li.text & "', "<BR> next<BR> strUsers = left(strUsers, len(strUsers)-2)<BR> imgGraph.imageUrl = "barGraph.aspx?users=" & strUsers<BR> imgGraph.visible = "true"<BR> session("chartUsers") = strUsers<BR> end if<BR> end sub<BR>Great, thanks!!thanks, it worked