Clear selection in ListView

T

Tim Wilson

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]);
}
 
T

Tim Wilson

Yes, many interfaces. But most of them are IUnknown to others :)

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top