Question : C# loop through checked items in listview box

I have a list view box with two colums (name and address), and I have enabled checkboxes on the listview box.  listview box is named lvDevices.  I would like to loop through each checked item and perfom a task, however when i tried using a standard for each statement, noted below, I got a casting error.  anyone have any suggestions?

            foreach (string cb in lvDevices.CheckedItems)
            {
                do some work
            }

Answer : C# loop through checked items in listview box

SweetingA,

You may want to have a look at my previous solution here:

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_25063189.html#a26340696

It allows you to specify the directory to list, and whether to go through the subfolders as well.

Patrick
Random Solutions  
 
programming4us programming4us