for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
fields[i,j] = new TextBox();
}
}
int xPos = 8;
int yPos = 8;
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
fields[i, j].Height = 20;
fields[i, j].Width = 20;
fields[i, j].MaxLength = 1;
fields[i, j].Left = xPos;
fields[i, j].Top = yPos;
fields[i, j].Text = "";
xPos += 25;
}
xPos = 8;
yPos += 25;
}
solveButton.Text = "Solve";
solveButton.Width = 100;
solveButton.Left = 75;
solveButton.Top = 235;
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 9; j++)
{
Controls.Add(fields[i,j]);
}
}
Controls.Add(solveButton);
solveButton.Click += new System.EventHandler(solveButton_Click);
public static void printPuzzle(int[,] board)
{
for (int a = 0; a < 9; a++) {
for (int b = 0; b < 9; b++) {
fields[a, b].Text = board[a, b].ToString();
Console.WriteLine(fields[a, b].Text);
}
}
}
private void solveButton_Click(object sender, System.EventArgs e)
{
populateArray();
solve();
}
Edit: On a side note, the button disappears after I click it... Not sure if the problems are related, but ask if you need to see more code.
This post has been edited by ericr2427: 27 June 2011 - 11:08 AM

New Topic/Question
Reply




MultiQuote






|