I am looking for optymalize code with displaying 2dimensional array of values on buttons. I have created grid of buttons like that: http://screenshot.sh/m2eZscO4i0fXq and I am actually displaying values of array on this buttons using this code:
button1.Text = board.gameBoard[0, 0].getValue().ToString();
button2.Text = board.gameBoard[0, 1].getValue().ToString();
button3.Text = board.gameBoard[0, 2].getValue().ToString();
button4.Text = board.gameBoard[0, 3].getValue().ToString();
button5.Text = board.gameBoard[1, 0].getValue().ToString();
...
button15.Text = board.gameBoard[3, 2].getValue().ToString();
button16.Text = board.gameBoard[3, 3].getValue().ToString();
Is there easier way to do that? It's working now (http://screenshot.sh/mMDP9pvcC7WOk), but it isn't the best way to do this thing I think. Can somebody show me how do that better?