I am currently trying to grab all the subitems from one column from every checked listviewitem, and display them in the richtextbox, but I am not sure how to do it. This is my current code.
I am also trying to do this in the ItemChecked Event.
foreach (ListViewItem item in listView1.Items)
{
if (listView1.CheckedItems.Count > 0)
{
richTextBox2.Text = listView1.CheckedItems[0].SubItems[1].Text;
}
}
I thought this would work but apparently not. All help is appreciated!
You are replacing the content of the textbox in each loop. Try appending the text with
+=. You also need to pick the correct itemYou could also write this with a LINQ expression and
String.Join