I'm writing a sudoku program, that uses textboxes as input. The text box names follow how an array works ie
(00,01,02,03,04 ,05,06,07,08
10,11,12,13,14, 15,16,17,18.... )
Now all i need to do is declare and load the array with those values. I was wondering if there was a way to use a for loop to load the values? Here is what i have so far.
public class MyClass
{
public int[,] LoadTable()
{
int[,] table = new int[9,9];
for (int i = 0; i < 9; i++)
{
for (int t = 0; t<9; t++)
{
table[i,t] = Convert.ToInt16 (txt[i][t]).Text);
}
}
return table;
}
}
Thanks!
(00,01,02,03,04 ,05,06,07,08
10,11,12,13,14, 15,16,17,18.... )
Now all i need to do is declare and load the array with those values. I was wondering if there was a way to use a for loop to load the values? Here is what i have so far.
public class MyClass
{
public int[,] LoadTable()
{
int[,] table = new int[9,9];
for (int i = 0; i < 9; i++)
{
for (int t = 0; t<9; t++)
{
table[i,t] = Convert.ToInt16 (txt[i][t]).Text);
}
}
return table;
}
}
Thanks!
Comment