Hi,
I am trying to create a league table. There are eight teams. The teams and their results are added to a text file on one form. The teams and results are seperated by a comma. On the second form i have a label where I am trying to display the teams and the total of points they have earned. For example in week one team 1 will play team 2 team one will have 3 points and team 2 will have 2 points. In week 2 team 1 will play team3, team 1 will have 2 points and team 3 will have 4 points. What i am trying to achieve is the label to display all eight teams with the total amount of points next to them. So team i should have 5 points next to their name. With the following code I have managed to display the first team and their first points (not all added together) and that is all. Could anyone please help?
public partial class frmLeague : Form
{
public frmLeague()
{
InitializeComponent();
}
int[] Scores = new int[8]{0,0,0,0,0,0,0,0};
string[] Teams = new string[8] { "The Flying Handbag", "South Shore Labour Club", "Kirkham Liberal Club", "Rossall Tavern", "Blackpool Deaf Society", "The Dinmore Hotel", "The Gardeners Arms", "Bispham Conservative Club" };
private void btnShow_Click(object sender, EventArgs e)
{
TextReader Reader = new StreamReader("results.txt");
string OutPut;
while (Reader.Peek()>8)
{
OutPut = Reader.ReadLine();
string[] Split = OutPut.Split(new Char[] { ',' });
for (int count = 0; count < 8; count++)
{
if (Split[0] == Teams[count])
{
Scores[count] = Scores[count] + Convert.ToInt32(Split[1]);
}
}
lblLeagueTable.Text = (Convert.ToString(Split[0]) + (Convert.ToString(Split[1])));
}
Reader.Close();
}