Do more with
Dim items As New List(Of String)
For Each itm In ListBox1.SelectedItems
Dim rst As String
rst = String.Join(",", items.ToArray)
Open in new window
'' This linq query will iterate through the selected items in the
'' ListBox control and build a comma seperated string of the selected values
'' The variable acc is the string that is being built and item is the next item in the ListBox
Dim s As String = (From r In ListBox1.SelectedItems
Select r).Aggregate(Function(acc As String, item As String) acc & ", " & item)
We’ve posted a new Expert Spotlight! Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.
IT issues often require a personalized solution. With Ask the Experts™, submit your questions to our certified professionals and receive unlimited, customized solutions that work for you.