Foreach, Error

Aug 21 2013 4:36 AM
In my windows form i have an error that says WindowsFormsApplication3.frnLoginPage DOES NOT CONTAIN A PUBLIC DEFINITION FOR 'GetEnumerator. Can some one help me with this error please.
Here is my code that i have and i have highlighted the errors on the form.

Kind regards.


using

System;

using

System.Collections;

using

System.Collections.Generic;

using

System.IO;

using

System.Linq;

using

System.Text;

using

System.Windows.Forms;

namespace

{


WindowsFormsApplication3class Utillities

{




{



public static void readFixtures(string theFile, ArrayList allpremiereFixtures) //local Variables









StreamReader inpremierFixtures = null;bool anyMorePremierFixtures = false;string[] fixtureData = new string[frmLoginPage.numFixItems];string[] teamData = new string[frmLoginPage.numTeamItems];Fixtures tempFix;Team tempTeam;int numTeamsInFix;//if file is ok then proceed


{

anyMorePremierFixtures =


if (Utillities.fileOpenForReadOK(theFile, ref inpremierFixtures))Utillities.getNext(frmLoginPage.numFixItems, inpremierFixtures, fixtureData);//loop for all fixtures


{

numTeamsInFix =


while (anyMorePremierFixtures == true)Convert.ToInt32(fixtureData[7]);// order = Location, Date , Time,Information, Home Team ,Away Team, Favourite,

tempFix =


new Fixtures(fixtureData[0], fixtureData[1], fixtureData[2], fixtureData[3], fixtureData[4], fixtureData[5], fixtureData[6], numTeamsInFixtures);//loop for all of the fixtures


{

getNext(


for (int i = 0; i < numTeamsInFix; i++)frmLoginPage.numTeamItems, inpremierFixtures, teamData);// team order= Nickname , logo , Owner, Manager, Name , Position in League


// Points, Games played , Goal Differance.

tempTeam =

teamData[5], teamData[6], teamData[7], teamData[8]);

}

}


}

}



new Team(teamData[0], teamData[1], teamData[2], teamData[3], teamData[4],if (inpremierFixtures != null) inpremierFixtures.Close();//write out data


{


public static void writeAllFixTeams(string theFile, ArrayList allpremierFixtures)//local variables



StreamWriter outputTeams = null;//create out


{


if (fileOpenForWtiteOK(theFile, ref outputTeams))//loop through each fixture


{

writeFixtures(outputTeams, currFixtures);


foreach (Fixtures currFixtures in allpremierFixtures)foreach (Team currTeam in currFixtures.getfixAllTeams()) //loop through each Team

writeTeam(outputTeams, currTeam);

}

outputTeams.Close();


//finish and tidy up


}

}


{


}


{


if (outputTeams != null) outputTeams.Close();private static bool fileOpenForWtiteOK(string theFile, ref StreamWriter outputTeams)throw new NotImplementedException();public static void writeTeam(StreamWriter writingOutTeam, Team thisTeam)// write out all its details

writingOutTeam.WriteLine(thisTeam.getNickname());

writingOutTeam.WriteLine(thisTeam.getLogo());

writingOutTeam.WriteLine(thisTeam.getOwner());

writingOutTeam.WriteLine(thisTeam.getManager());

writingOutTeam.WriteLine(thisTeam.getName());

writingOutTeam.WriteLine(thisTeam.getPosition());

writingOutTeam.WriteLine(thisTeam.getPoints());

writingOutTeam.WriteLine(thisTeam.getGames_Played());

writingOutTeam.WriteLine(thisTeam.getGoalDiff());

}


//services


{


public static bool getNext(int numItems, StreamReader inNext, string[] nextTeamData)// locals




string nextLine;int numDataItems = numItems;//readFixtures Team Data - based on numDataItems


{



nextLine = inNext.ReadLine();


nextTeamData[i] = nextLine;


for (int i = 0; i < numDataItems; i++)try{if (nextLine != null)else

{


return false; // no more full teams to process

}

}


{

System.Windows.Forms.


catch (Exception e)MessageBox.Show("ERROR Reading from file. Incomplete Data. \n" + e.Message);return false; // Problem , could not read the file

}

}


return true; // no issues

}


// services


// fixture order = Location, date, time, Information, Home team , away team , Favourite


{

writingOutFixtures.WriteLine(thisFixtures.getfixLocation());

writingOutFixtures.WriteLine(thisFixtures.getfixDate());

writingOutFixtures.WriteLine(thisFixtures.getfixTime());

writingOutFixtures.WriteLine(thisFixtures.getfixInformation());

writingOutFixtures.WriteLine(thisFixtures.getfixHome_Team());

writingOutFixtures.WriteLine(thisFixtures.getfixAway_Team());

writingOutFixtures.WriteLine(thisFixtures.getfixFavourite());

}


public static void writeFixtures(StreamWriter writingOutFixtures, Fixtures thisFixtures)// services


{


public static void showListOfFixtures(TextBox textBoxOutput)// clear TextBox

textBoxOutput.Clear();



string output;// output data


{


foreach (Fixtures textBox in frmLoginPage.frmkeeppremierFixtures)if (textBox.getFixItemsAllTeams(Count) > 0)// if there are any teams

{


{

output = (

+

+

textBoxOutput.Items.Add(output);

}

}


foreach (Fixtures f in textBox.getnumFixtureItems())" Fixture" + textBox.getnumFixtureItems() + f.getfixLocation() + " Location " + f.getfixDate() + " Date " + f.getfixTime()" Time " + f.getfixInformation() + " Information " + f.getfixHome_Team() + " Home team " + f.getfixAway_Team()" Away Team " + f.getfixFavourite() + ".");else


// show fix with no teams yet

{

output = (

textBoxOutput.Items.Add(output);

}

}

}



" fixture " + textBox.getnumFixtureItems() + " has no teams yet");// In put validation


{


public static bool fileOpenForWriteOK(string writeFile, ref StreamWriter dataOut)//open file and check for Errors


try

{

dataOut =


}


{

System.Windows.Forms.



}


{

System.Windows.Forms.



}

}


new StreamWriter(writeFile);return true;catch (FileNotFoundException notFound)MessageBox.Show("Error Opening File ( when writing data out)" +"- File could not be found.\n" + notFound.Message);return false;catch (Exception e)MessageBox.Show("Error Opening File( when writing data out)" +"- Operation failed.\n" + e.Message);return false;//Input Validation


{


public static bool fileOpenForReadOK(string readFile, ref StreamReader dataIn)// open files and check for Errors


try

{

dataIn =


}


{

System.Windows.Forms.


}


{

System.Windows.Forms.


}

}


new StreamReader(readFile);return true;catch (FileNotFoundException notFound)MessageBox.Show("Error when reading data in )- File could not be found.\n" + notFound.Message);return false;catch (Exception e)MessageBox.Show("ERROR Opening File (when reading data in)- Operation failed.\n" + e.Message);return false;// input validation


{


{

System.Windows.Forms.

txtCurrent.Focus();


}


}


public static bool notNullTextBox(TextBox txtCurrent, String userFeedback)if (txtCurrent.Text == "")MessageBox.Show("ERROR - The input for " + userFeedback + " cannot be empty!. Please input again ... ");return false;else return true;// Input Validation


{


}


public static bool validNumOfFixtures()return true;//input Validation


{


public static bool validNumber(TextBox txtBeingTested, string outputString)try

{



}


{


txtBeingTested.Text =

txtBeingTested.Focus();


}

}


Convert.ToInt32(txtBeingTested.Text);return true;catch (FormatException e)MessageBox.Show("INVALID Input: " + e.Message + "The input for " + outputString + "is not a valid number");"";return false;

public

static int numTeamsInFixtures { get; set; }

public

}

}















static object Count { get; set; }

Answers (3)