When you debug, you look at the values of the variables. Set a break point on the line I showed you with F9. Then start a debugging session by pressing F5. When the program opens, navigate through until you hit the break point. Step over (F10) each line of code until you get to the following:

Code:
 
DirectoryInfo dr = new DirectoryInfo(@path);
 
List<string> relatedfiles = new List<string>();
 
foreach (FileInfo related in dr.GetFiles(items + ".*"))
The two variables of interest are the "@path" variable and the "items" variable. What we are looking for is for the contents of these variables to contain type and data that is valid for the particular method being called.

For example, does "@path" contain a properly formed directory path (e.g. "D:\Program Files") that will work in a DirectoryInfo(...) constructor? If not, then you need to back up in the program (by stopping the debugging session and set a break point on the line where "@path" has been set) and figure out why "@path" doesn't contain the correct value.

Similarly, the dr.GetFiles(...) method. This method requires a search filter (like "notep*.exe"). You are passing an "items" collection variable and appending ".*" That will probably give you the generic name of collection with a ".*" appended. Probably something like "SelectedListViewItemCollection.*" That probably isn't going to be the search filter you are looking for.

Understand my goal here isn't to point you to the specific problem. Instead, it's to teach you how to you the debugger and think about the problem so you can figure out the issues on your own.