The MSDN links you want to read are ListViewItem and ListViewSubItem .
You access the elements of the list item list item through the ListViewItem.SubItems property. The most important thing to remember is that the first subitem refers to the owner list item, so to access the actual subitems you need to index from 1. This will return you a ListViewSubItem , and you can get its text enter ListViewSubItem.Text .
i.e
SubItems[0] provides a parent list view item
SubItems[1] provides the first subheading, etc.
Fast, nasty piece of code
private void listView1_SelectedIndexChanged(object sender, EventArgs e) { ListView.SelectedIndexCollection sel = listView1.SelectedIndices; if (sel.Count == 1) { ListViewItem selItem = listView1.Items[sel[0]]; textBox1.Text = selItem.SubItems[1].Text; } }
Hope that helps
source share