Reputation: 133
I want to get all checked items from CheckedListBox1 to TextBox1.
So far i tried:
TextBox1.Text = CheckedListBox1.Items.Cast(Of String).ToArray
not working.
Any ideas?
Upvotes: 2
Views: 2463
Reputation: 4427
C# (Question originally had C# tag)
CheckedListBox.CheckedItemCollection items = checkedListBox1.CheckedItems;
foreach (string item in items) {
textBox1.Text += item;
}
Upvotes: 1
Reputation: 633
TextBox1.Text
is a String
, and you're going to assign a String[]
to a String
. It's totally nonsense. Try to assign to TextBox1.Lines
.
Update - Try this
TextBox1.Lines = CheckedListBox1.Items.Cast(Of String).ToArray
Upvotes: 1
Reputation: 364
Not tested:
For Each clb As String In CheckedListBox1.CheckedItems
textbox1.AppendText(clb & Environment.NewLine)
Next
Upvotes: 1