Reputation: 1
I have Listbox1 with multiple selection mod. Now i want, when items in that Listbox are selected to pass them on next form. Listbox is on form1, when clicked next to form2 to show me in label on form2 what items are selected in Listbox form1.
tried this
foreach (var item in listBoxSobe.SelectedItems)
{
lblSobe.Text += (lblSobe.Text == "" ? "" : ", ") + item.ToString();
}
but as result i get "System.Data.DataRowView.." , and not clicked items from Listbox
Upvotes: 0
Views: 2110
Reputation: 31239
Maybe something like this:
foreach (DataRowView item in listBoxSobe.SelectedItems)
{
lblSobe.Text += (lblSobe.Text == "" ? "" : ", ") + item["TheColumnYouWant"].ToString();
}
Upvotes: 1