Reputation: 21
I'm attempting to construct a database using the C# Console, but I'm getting an error thrown that I can't seem to find the problem with. The problem is in my Query function, when I attempt to define the path based off of user input. Essentially, it looks into a given folder in the user folder, and within it another subfolder containing the files wherein is the database information. Im using the Path.Combine function to dynamically define the path throughout my code, but I'm getting the following error;
ArgumentNullException: Value cannot be null. (Parameter 'path3')
Even though all strings are defined and not null.
this is what the line of code looks like:
path = Path.Combine(Info.path, "infolder", classrooms.inventory, classrooms.geninv, userinput)
And here is all of the code that the strings in the path arguement are referencing:
class classrooms
{
public static string Teacher;
public static string Roomnumber;
public static string Changes;
public static string inventory = "inventory";
public static string geninv = "GenInv";
public static string classinv = "ClassInv";
}
and
class Info
{
public static string path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
}
if necessary I can attach my full code.
Upvotes: 1
Views: 3978
Reputation: 21
I figured it out. It was an improperly defined string that the pathcombine function was using in another instance of the code, and it was just getting caught up once i reused the path.combine function. Thanks for all the answers, I wouldn't have thought to look at that without all the input.
Upvotes: 1