المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Beginner in need of help



C# Programming
10-24-2009, 06:00 AM
Hi everyone, as already stated I am completely new to c#, I am trying to write a program that will generate random scores for football games in a league where each team plays one another once, however after generating the score i wish to assess which team should be awarded 3 points for winning or if both should be awarded 1 point, so I can produce these in a league table. I have written this code but get an error saying " input string was not in a correct format", here is the part of my code causing the error:


if (Convert.ToInt16(score.Text) > Convert.ToInt16(score2.Text))
{
points12 += 3;
}
else if (Convert.ToInt16(score.Text) < Convert.ToInt16(score2.Text))
{
points4 += 3;
}
else
{
points4 += 1;
points12 += 1;
}

Any help would be greatly appreciated
Thanks in advance