display selectedItems in a label
I need to display t开发者_开发技巧he selecteditems in a label I am using VB 2005 I set the selection mode to multi-extended It did work selecting only one item with the following code: me.xresultslabel.text= me.xlisttextbox.text.selectedItem.tostring
But when I tried to display more than one item using the following code: me.resultlabel.text= me.xlisttextbox.text.selectedItems, I get the following string on the label: system.windows.forms.listbox+selectedobjetcollections.
any help will be highly appreciate
Dim collection = Me.xlisttextbox.Text.SelectedItems
Dim builder As New StringBuilder()
For i As Integer = 0 To collection.Count - 1
If i > 0 Then builder.Append(", ")
builder.Append(collection(i))
Next
Me.resultlabel.Text = builder.ToString
精彩评论