private void DisplayGame() { int[,] board = game.GetStartBoard(); currentBoard = new int[9, 9]; for (int r = 0; r < 9; r++) { for (int c = 0; c < 9; c++) { string cellName = "cell" + r.ToString() + c.ToString(); TextBox txtbx = (TextBox)this.FindName(cellName); if (board[r, c] == 0) { txtbx.Text = ""; txtbx.IsReadOnly = false; txtbx.MaxLength = 1; txtbx.MaxLines = 1; txtbx.Foreground = new SolidColorBrush(Colors.Blue); } else { txtbx.Text = board[r, c].ToString(); txtbx.IsReadOnly = true; txtbx.Foreground = new SolidColorBrush(Colors.Black); } currentBoard[r, c] = board[r, c]; txtbx.TextChanged += new TextChangedEventHandler(TextChanged); } } }