S
S
Sergey Bezuglov2013-12-05 11:16:28
Windows Forms
Sergey Bezuglov, 2013-12-05 11:16:28

How to display a 2-dimensional array of strings in a C# winforms application with columns and rows unknown in advance?

How to display a 2-dimensional array of strings in a C# winforms application with columns and rows unknown in advance?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2013-12-05
@besuglovs

You can use DataGridView:
For example like this:

string[,] arr = new string[m, n];
dataGridView1.RowCount = m;
dataGridView1.ColumnCount = n;
for (int i = 0; i < m; i++)
  for (int j = 0; j <n; j++)
    dataGridView1.Rows[i].Cells[j].Value = arr[i, j];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question