i have this code:
basically i have this part of code where this will determine which player is next according to the number of clicks...in the form3_load event i made a loop for 64 (coz have 64 buttons) of array which will call the mouseclicks event
in the mouseclicks event i have a varibel clicks to see home many clicks there is.. i am checking if the number is odd or even to determine the which player, if even than player one, if odd player two...
the program only works for the first click becoz from the 64 loop it goes to the other event and never goes back to continue the other loop
can some one help pls?
Code:
private void mouseclicks(object sender, EventArgs e) { int clicks = 0; clicks++; if (clicks % 2 == 0) { label5.Text = "Player One's Turn"; } else label5.Text = "Player Two's Turn"; } private void Form3_Load(object sender, EventArgs e) { for (int x = 0; x < 64; x++) { this.buttonarray[x].Click += new System.EventHandler(this.mouseclicks); } }
in the mouseclicks event i have a varibel clicks to see home many clicks there is.. i am checking if the number is odd or even to determine the which player, if even than player one, if odd player two...
the program only works for the first click becoz from the 64 loop it goes to the other event and never goes back to continue the other loop
can some one help pls?
Comment