This is a simple program I wrote to teach myself some C#. It is a lotto number picker that creates a game object which is an array of 6 numbers then, on pressing the 'Create' button, prints it out in a text box. The program works fine in debug mode but only displays the first set on numbers in release mode. Thanks for any help given.
public int NoOfGames { get; set; }
List<Game> myList = new List<Game>();
private void btnCreate_Click(object sender, EventArgs e)
{
NoOfGames = (int)udNumber.Value;
myList.Clear();
txtList.Text = "";
String vl = "";
for (int i = 0; i < NoOfGames; i++)
{
Game game = new Game();
game.ClearGame();
game.FillGameArray();
myList.Add(game);
for (int j = 0; j < 6; j++)
vl += String.Format("{0}, ", myList[i].gameArray[j]);
vl += "\r\n";
}
txtList.Text = vl;
}
Comments
Post a Comment