Click here to Skip to main content
15,908,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can any one help me out with following. I am trying to parse the folders and sub folders.I tried several ways but no luck.Using the Module. But I am getting the following error.The error is Value cannot be null parameter name:path.Below is the code,can anyone tell me where i am making the mistake.
C#
public struct Kbpathbase
        {
public string project;
}
public static Module1.Kbpathbase kb; 


=========In the Crate new form i have passed the following code ==========
C#
private void parseProjects()
        {
            int i;
            DirectoryInfo[] arrDirectoryInfo;
            try
            {
                lv.Items.Clear();
                DirectoryInfo directoryInfo1 = new DirectoryInfo(Module1.kb.project);
                arrDirectoryInfo = directoryInfo1.GetDirectories();
                i = 0;
                while (i < arrDirectoryInfo.Length)
                {
                    lv.Items.Add(arrDirectoryInfo[i].Name, 0);
                    i++;
                }
            }
            catch (Exception exception1)
            {
                Interaction.MsgBox(exception1.Message, MsgBoxStyle.Critical, null);
                Information.Err().Clear();
            }

        }
Posted

1 solution

Last time I checked, the DirectoryInfo class was constructed with a 'path' - eg

C#
DirectoryInfo directoryInfo1 = new DirectoryInfo(@"C:\");


so Im not quite sure what you are trying to achieve with your

C#
DirectoryInfo directoryInfo1 = new DirectoryInfo(Module1.kb.project);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900