• Create Account

### #Actualdemongunsman

Posted 13 February 2013 - 05:45 AM

Ive got this text file Im trying to read from. Its located in my resources folder in microsoft visual studio. Im trying to access that text file so I can parse the text from that file to an integer and store it in my integer array called Armor[,] .The contents of the text file is a 12x11 chart of numbers which I would like to parse to an integer and store into the 2D Armor[,] array. Here are the contents of the text file:

http://pastebin.com/Nq4XFCYM

When I run the program I get an error saying:

Value cannot be null.
Parameter name: path

The error that microsoft visual studio's throwing is because of the line:

StreamReader armorStream = new StreamReader(Resources.Armor);

//namespace used do directly access Resource.FileName
using TurfBattles.Properties;

{

//Create a variable for storing the armor defense values

int[,] Armor = new int[12, 11];

//Create a string variable for storing the stream readers input
string myString = new string();

int Row = 0;

//do this:

while ((myString = armorStream.ReadLine()) != null)

{

//Loop through each value of the myStringSplit array

for (int Column = 0; Column < 11; Column++)

{

//This splits the text up and stores it into an array of strings

//It also stores the white spaces into a character array

string[] myStringSplit = myString.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

//Store the current value of myStringSplit into the Armor Array

Armor[Row, Column] = int.Parse(myStringSplit[Column]);

}

Console.WriteLine();

Row++;

}

armorStream.Close();

}



### #5demongunsman

Posted 13 February 2013 - 05:32 AM

Ive got this text file Im trying to read from. Its located in my resources folder in microsoft visual studio. Im trying to access that text file so I can parse the text from that file to an integer and store it in my integer array called Armor[,] .The contents of the text file is a 12x11 chart of numbers which I would like to parse to an integer and store into the 2D Armor[,] array When I run the program I get an error saying:

Value cannot be null.
Parameter name: path

The error that microsoft visual studio's throwing is because of the line:

StreamReader armorStream = new StreamReader(Resources.Armor);

//namespace used do directly access Resource.FileName
using TurfBattles.Properties;

{

//Create a variable for storing the armor defense values

int[,] Armor = new int[12, 11];

//Create a string variable for storing the stream readers input
string myString = new string();

int Row = 0;

//do this:

while ((myString = armorStream.ReadLine()) != null)

{

//Loop through each value of the myStringSplit array

for (int Column = 0; Column < 11; Column++)

{

//This splits the text up and stores it into an array of strings

//It also stores the white spaces into a character array

string[] myStringSplit = myString.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

//Store the current value of myStringSplit into the Armor Array

Armor[Row, Column] = int.Parse(myStringSplit[Column]);

}

Console.WriteLine();

Row++;

}

armorStream.Close();

}



### #4demongunsman

Posted 13 February 2013 - 05:27 AM

Ive got this text file Im trying to read from. Its located in my resources folder in microsoft visual studio. Im trying to access that text file so I can parse the text from that file to an integer and store it in my integer array called Armor[,] .The contents of the text file is a 12x11 chart of numbers which I would like to parse to an integer and store into the 2D Armor[,] array When I run the program I get an error saying:

Value cannot be null.
Parameter name: path

The error that microsoft visual studio's throwing is because of the line:

StreamReader armorStream = new StreamReader(Resources.Armor);

//namespace used do directly access Resource.FileName
using TurfBattles.Properties;

{

//Create a variable for storing the armor defense values

int[,] Armor = new int[12, 11];

int Row = 0;

//do this:

while ((myString = armorStream.ReadLine()) != null)

{

//Loop through each value of the myStringSplit array

for (int Column = 0; Column < 11; Column++)

{

//This splits the text up and stores it into an array of strings

//It also stores the white spaces into a character array

string[] myStringSplit = myString.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

//Store the current value of myStringSplit into the Armor Array

Armor[Row, Column] = int.Parse(myStringSplit[Column]);

}

Console.WriteLine();

Row++;

}

armorStream.Close();

}



### #3demongunsman

Posted 13 February 2013 - 05:26 AM

Ive got this text file Im trying to read from. Its located in my resources folder in microsoft visual studio. Im trying to access that text file so I can parse the text from that file to an integer and store it in my integer array called Armor[,] .The contents of the text file is a 12x11 chart of numbers which I would like to parse to an integer and store into the 2D Armor[,] array When I run the program I get an error saying:

Value cannot be null.
Parameter name: path

The error that microsoft visual studio's throwing is because of the line:

StreamReader armorStream = new StreamReader(Resources.Armor);

public void LoadArmor()

{

//Create a variable for storing the armor defense values

int[,] Armor = new int[12, 11];

int Row = 0;

//do this:

while ((myString = armorStream.ReadLine()) != null)

{

//Loop through each value of the myStringSplit array

for (int Column = 0; Column < 11; Column++)

{

//This splits the text up and stores it into an array of strings

//It also stores the white spaces into a character array

string[] myStringSplit = myString.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

//Store the current value of myStringSplit into the Armor Array

Armor[Row, Column] = int.Parse(myStringSplit[Column]);

}

Console.WriteLine();

Row++;

}

armorStream.Close();

}



### #2demongunsman

Posted 13 February 2013 - 05:25 AM

Ive got this text file Im trying to read from. Its located in my resources folder in microsoft visual studio. Im trying to access that text file so I can parse the text from that file to an integer and store it in my integer array called Armor[,] .The contents of the text file is a 12x11 chart of numbers which I would like to parse to an integer and store into the 2D Armor[,] array When I run the program I get an error saying:

Value cannot be null.
Parameter name: path

The error that microsoft visual studio's throwing is because of the line:

StreamReader armorStream <span>=</span> <span>new</span> StreamReader<span>(</span>Resources<span>.</span><span>Armor</span><span>)</span><span>;</span>

public void LoadArmor()

{

//Create a variable for storing the armor defense values

int[,] Armor = new int[12, 11];

int Row = 0;

//do this:

while ((myString = armorStream.ReadLine()) != null)

{

//Loop through each value of the myStringSplit array

for (int Column = 0; Column < 11; Column++)

{

//This splits the text up and stores it into an array of strings

//It also stores the white spaces into a character array

string[] myStringSplit = myString.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

//Store the current value of myStringSplit into the Armor Array

Armor[Row, Column] = int.Parse(myStringSplit[Column]);

}

Console.WriteLine();

Row++;

}

armorStream.Close();

}



### #1demongunsman

Posted 13 February 2013 - 05:23 AM

Ive got this text file Im trying to read from. Its located in my resources folder in microsoft visual studio. Im trying to access that text file so I can parse the text from that file to an integer and store it in my integer array called Armor[,] .The contents of the text file is a 12x11 chart of numbers which I would like to parse to an integer and store into the 2D Armor[,] array When I run the program I get an error saying:

Value cannot be null.
Parameter name: path

The error that microsoft visual studio's throwing is because of the line:

StreamReader armorStream <span>=</span> <span>new</span> StreamReader<span>(</span>Resources<span>.</span><span>Armor</span><span>)</span><span>;</span>

public void LoadArmor()

{

//Create a variable for storing the armor defense values

int[,] Armor = new int[12, 11];

int Row = 0;

//do this:

while ((myString = armorStream.ReadLine()) != null)

{

//Loop through each value of the myStringSplit array

for (int Column = 0; Column < 11; Column++)

{

//This splits the text up and stores it into an array of strings

//It also stores the white spaces into a character array

string[] myStringSplit = myString.Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

//Store the current value of myStringSplit into the Armor Array

Armor[Row, Column] = int.Parse(myStringSplit[Column]);

}

Console.WriteLine();

Row++;

}

armorStream.Close();