int[,] matrix = new int[,] {{5, 5, 5, 5},
{8, 9, 3, 1},
{7, 9, 2, 7},
{3, 7, 8, 6},
{8, 3, 1, 2}};
You will need to create a multiline TextBox
to show this information. Then use something like this to write the matrix to the TextBox
:
string matrixString = "";
for (int i = 0; i < matrix.GetLength(0); i++)
{
for (int j = 0; j < matrix.GetLength(1); j++)
{
matrixString += matrix[i, j].ToString();
matrixString += " ";
}
matrixString += Environment.NewLine;
}
this.textBoxName.Text = matrixString;
You get this result: