How can I print an array in windows forms? I tried the listbox using this code:
public void Mostrar_Grafo(int Qtdlinha,int Qtdcoluna, string[,] MAdjacencia)
{
ListBox listbox1 = new ListBox();
listbox1.Size = new System.Drawing.Size(400, 400);
listbox1.Location = new System.Drawing.Point(10, 10);
this.Controls.Add(listbox1);
listbox1.MultiColumn = true;
listbox1.BeginUpdate();
listbox1.Items.Add("Matriz de Adjacencia");
listbox1.Items.Add("");
for (int i = 0; i < Qtdlinha; i++)
{
for (int j = 0; j < Qtdcoluna; j++)
{
listbox1.Items.Add(" " + MAdjacencia[i, j] + " ");
}
}
}
But it shows the numbers in a disorganized way as shown in the figure below:
I need it to show in array format like this example:
0 1 0 0 0 0 0
1 0 1 0 0 0 0
0 1 0 1 1 1 0
0 0 1 0 1 1 0
0 0 1 1 1 1 0
0 0 1 1 1 0 0
0 0 0 0 0 1 1