Put your code in code tags in forum, don’t send file. Using code tags properly
You have big problems with brackets, here you are short tutorial:
Example of correct code structure
public class NameOfClass
{ // starts class's block
void Method() // declare method
{ // starts Method's block
foreach(var item in collection)
{ // starts foreach loop block
// code
} // ends foreach loop block
} // ends Method's block
void SecondMethod() // declare second method
{ // starts SecondMethod's block
//code
} // ends SecondMethod's block
} // ends class's block
You can’t do something like this.
public class NameOfClass
{ // starts class's block
void Method() // declare method
{ // starts Method's block
void SecondMethod() // declare method in method
{ // starts SecondMethod's block
foreach(var item in collection) { } // inlined start and end foreach loop
item.ToString() // you are outside loop
} // ends SecondMethod's block
} // ends Method's block
} // ends class's block