Hello -

I cannot understand why I cannot get a win message box to show for my naughts and crosses game? I'm puzzled because no errors show - so I am guessing that I need to be making a 'win method' or something similar ???:confused:

Button[,] nandcButton = new Button[3,3];

            for (int x = 0; x < 3; x++)//loop relating to rows i think?
            {
              
               for (int y = 0; y < 3; y++)//loop relating to columns i think? 
               {
                  nandcButton[x, y] = new Button();//Create the Buttons
                  nandcButton[x,y].Name = "nandcButton" + x + ","+ y;//name and coordinates and set up number, number to show
                  nandcButton[x,y].Width = 60;
                  nandcButton[x,y].Height = 60;
                  nandcButton[x,y].Left = nandcButton[x,y].Left + nandcButton[x,y].Width + (x * 60);
                  nandcButton[x,y].Top = nandcButton[x,y].Top + nandcButton[x,y].Top + 50 + (y * 60); //Centre the button 
                  nandcButton[x,y].Click += new EventHandler(Button_Click); //links the above button spec.
                  //Add them to the container
                  nandcHolder.Controls.Add(nandcButton[x,y])


                 if   ((nandcButton[0,0].Text == "0" && nandcButton[1,0].Text == "0" && nandcButton[2,0].Text == "0"))     
                  {
                      MessageBox.Show("Naughts won");
                      Form newForm = new winnerForm();//show if NAUGHTS wins - pass winner and score
                      newForm.Show();
                      

                          }

I'm just trying with the first line for now - but no joy - I expect I am missing something obvious! .... John.

Form newForm = new winnerForm();//show if NAUGHTS wins - pass winner and score

newForm.Show();



//call above then output a messagebox from winnerForm

any good?

Thanks for the help - the problem was that I hadn't declared the button array globally at the top of the form and so they weren't being recognised .... mmmmmm.

This question has already been answered. Start a new discussion instead.