how can retrieve a checked list of objects from ObjectListView c#?

Posted by Sidaoui Mejdi on Stack Overflow See other posts from Stack Overflow or by Sidaoui Mejdi
Published on 2013-11-13T14:13:36Z Indexed on 2013/11/13 15:54 UTC
Read the original article Hit count: 395

Filed under:
|

I'm using ObjectListView with checkboxes, I would like to run a function on selected items to delete them. So i tried this Method but it not working:

private List<Matricule> matrs;
private void button1_Click(object sender, EventArgs e)
        {
            //List<Song> s = this.olvSongs.CheckedObjects.Count;
            //MessageBox.Show(this.olvSongs.CheckedItems.Count + "  " + this.olvSongs.CheckedObjects.Count);

            string s = "";
            foreach (var item in olvMatrs.SelectedItems)
            {
                matrs.Remove((Matricule)item);
            }
this.olvSongs.SetObjects(matrs);
        }

how can i do this task.

© Stack Overflow or respective owner

Related posts about c#

Related posts about objectlistview