Clear selection in ListView

  • Thread starter Thread starter Elisa
  • Start date Start date
If you want to clear (unhighlight) the selected item(s):
for (int x = (this.listView1.SelectedIndices.Count - 1); x >= 0; x--)
{
this.listView1.Items[this.listView1.SelectedIndices[x]].Selected = false;
}

If you want to remove the selected item(s):
for (int x = (this.listView1.SelectedIndices.Count - 1); x >= 0; x--)
{
this.listView1.Items.RemoveAt(this.listView1.SelectedIndices[x]);
}
 
Yes, many interfaces. But most of them are IUnknown to others :)

--
Tim Wilson
..Net Compact Framework MVP
{cf147fdf-893d-4a88-b258-22f68a3dbc6a}
 
Back
Top