for (int i = 0; i < listView1.Items.Count; i++ )
{
if (listView1.Items[i].Selected)
{
listView1.Items[i].Remove();
}
UPDATE :: I found out that the code above is limited
to deleting only the first row
when the SelectMultipleRows option is true,
so i googled and found a better
alternative:
while (listView1.SelectedIndices.Count > 0)
{
listView1.Items.RemoveAt(listView1.SelectedIndices[0]);
}
Tuesday, 30 June 2009
List view Items in C#
I'm always using listviews in c#. In a former project i had the same issue as with the timing app: "How to select an index from selected row in the listview". I googled it and here is what i found, and works just fine:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment