I have the following piece of code that is suppose to extract some info from a file.
private string[][] users;
private string userID;
public void getInfo()
{
string[] lines = System.IO.File.ReadAllLines(@"U:\Final Projects\Bank\ATM\db.txt");
for (int i = 0; i < lines.Count(); i++ )
{
string[] values = lines[i].Split(',');
for (int b = 0; b < 5; b++ )
{
users[i][b] = values[b];
}
}
}
the line users[i][b] = values[b];
returns the error : " Object reference not set to an instance of an object. " but I am not sure why. the code is suppose to read each line and split the line by ,
and create 2 dimensional array from the info.