We appreciate your help. Please do not resurrect threads that are years old. By doing so you run the risk of confusing current posters and/or reopening old wounds. Please read the rules before posting again - ... and ... . Thread Closed.
I thought one of those events pass the ListViewItem object as parameter just like TreeView returns TreeViewNode but I was mistaken.
You can use just "tbSearch.Text = lv.FocusedItem.SubItems.Text;" and it would do it.
You must simply "walk through the listview" till you get the index of selected row and then you can do whatever you want in that row LIKE THIS:
for (int i = 0; i < lv.Items.Count; i++)
// is i the index of the row I selected?
if (lv.Items[i].Selected == true)
//I show here the second field text (SubItems.Text) from the selected row(Items[i])
Thats upto the guy who marks it as answered, wether he goes for the first answer, or the better answer, or in fact the wrong answer.. its entirely his choice. In a way Lord Soth beat you too it too, but, its upto the guy who grants the point..
I'd agree with LizR on this. The selected indices will be smaller than the entire list. If a list has a few hundred items and the user has selected 3, the loop becomes considerably less expensive on the indices rather than the entire list.
Insted of going through all the items go through only the selected items
Dim col As ListView.SelectedListViewItemCollection = lviFolders.SelectedItems
Dim itm As ListViewItem
For Each itm In col