class Puzzle
{
private int PUZZLESIZE = 3;
private int col, row;
private Button[,] buttons;
public Puzzle()
{
}
public Puzzle(Form1 form1)
{
buttons = new Button[3, 3]
{ { form1.button1, form1.button2, form1.button3 },
{ form1.button4, form1.button5, form1.button6 },
{ form1.button7, form1.button8, form1.button9 } };
}
public void reset()
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
{
buttons[i, j].BackColor = Color.Lime;
}
}
buttons[i, j].BackColor = Color.Lime;
this line causes NullReferenceException when I call the reset method in Form1.cs. Any advice is appreciated!!!
reset()from? How are the buttons inform1built?