I have a 2D array of PictureBox, and I want in a loop to change each picturebox's location and add it to the form, but when I change one cell's property it changes every one of the other cells too.
(The constructor gets the form's object and sets it to form variable)
private Form form;
private PictureBox[,] board = new PictureBox[8, 8];
private void PrintBoard()
{
for (int i = 0; i < 8; i++)
{
for (int j = 0; j < 8; j++)
{
board[i, j].Left = j * 20;
form.Controls.Add(board[i, j]);
}
}
}
ifrom?