Reputation: 921
I have a Listener on the DoubleClick event in a ListView. I have also activated FullRowSelect.
So when I double-click a row, only the value in the first column appears. I also tried it directly with SelectedItems
.
Please help
Code:
private void lvRecipesPos_DoubleClick(object sender, EventArgs e)
{
String s = "";
foreach (ListViewItem item in lvRecipesPos.Items)
{
if (item.Selected == true)
{
s += item.Text.ToString();
}
}
MessageBox.Show(s);
}
Upvotes: 0
Views: 9966
Reputation: 4023
1) The ListView
has a SelectedItems
collection, so you don't have to iterate all items and check if they're selected.
2) Item
has a SubItems
collection which holds the texts for all sub items
Upvotes: 3