Tell me, please, which component in the form of a table can be used in C # Windows Forms for matrix input / output? (Something like a StringGrid in Delphi)

In Google they say that DataGridView is suitable for this, but it is rather complicated, besides related to databases.

  • See DataGrid (predecessor of DataGridView), ListView in Details mode, ListBox with MultiColumn = true property, and TableLayoutPanel . - Alexander Petrov
  • Thank you so much iluxa1810! Everything works) - New_User

1 answer 1

Use DataGridView in it there is nothing difficult.

DataGridView universal and serves to display any collection and not only from the database.

In order to bind elements to it you need a collection, for example List<T> .

After you create the collection, you do:

DataGridView.DataSource = <your collection> and the data is automatically entered into a table.

This is the easiest option.

But with the array will have to tinker a bit.

For example, there is an array of string [,] mas of NxM dimension

 dataGridView1.RowCount = N; dataGridView1.ColumnCount = M; int i, j; for(i = 0; i < N; ++i) for(j = 0; j < M; ++j) dataGridView1.Rows[i].Cells[j].Value = mas[i, j]; 

In my opinion the best thing is to use collections.