none
Tic Tac Toe Game in C# visual 2012 RRS feed

  • Question

  • Hi,

    I am using visual 2012 C# . I am making a tic tac toe game for windows 8. its in running state now but some problem. there are nine buttons are placed on it named as button1,button2,...button9 . when one player clicks on button1 it should be locked not to be overwrite but second player click on the same button and it does.but it should not does so this is the problem occur in my game.how can  I resolve this problem.

    private

    asyncvoidwin()

            {   

    if(button1.Content.ToString() == "X"&& button2.Content.ToString() == "X"&& button3.Content.ToString() == "X")

                    {

    //Message Display that player x wins

                       

    //Clear All Buttons

          } and so on with other buttons and same for player o

    private

    voidbuttons(objectsender, RoutedEventArgse)

            {

               

    if(Flag == false)

                {

                    ((

    Button)sender).Content = "X";

                    Flag =

    true;

                }

               

    else


                {

                    ((

    Button)sender).Content = "O";

                    Flag =

    false;

                }

                win();

            }

    now this plays well but it can overwrite the previous one value which the player1 write .

    plz help me out in this regard!feel free and suggest me plz...plz

    Sunday, November 4, 2012 5:56 PM

Answers