nvn
nvn

Reputation: 11

How Do I Transfer Listbox Items Into A Textbox By Clicking A Button C#

I have a Listbox in which items are collcted.

I want all items in listbox to be transferred into textbox by clicking a button.

And each item must be separated by character #

Thanks in advance.

Upvotes: 0

Views: 488

Answers (1)

Jay
Jay

Reputation: 1309

 string str1 = "";
            foreach(var k in listBox1.Items)
            {
                str1  = str1 + " #" + k; 
            }
            textBox1.Text = str1; 

Upvotes: 2

Related Questions