Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

VS 2010 How to turn all of a Listbox's items into a string

$
0
0
I'm trying to find a way how to get a Listbox's items into a label.
The listbox looks like this:
Code:

WORD,#
WORD,#

I'd like the label to look like this: "WORD,#,WORD,#,WORD,#"

Could somebody help me out?

EDIT: Nevermind, got it. Just used this:
Code:

        Dim elements(ListBox1.Items.Count - 1) As String
        ListBox1.Items.CopyTo(elements, 0)
        Dim stringNames As String = String.Join(",", elements)


Viewing all articles
Browse latest Browse all 42220

Trending Articles