I need to populate a .net DataGridView from a collection physically (without data binding) in C#. That is, I should use foreach loops and iterate through the collection while creating a row for each object and a cell for each property.
I have created the columns in design mode. Now I need to create rows dynamically.
How to do that?
Add an array of objects, the number of which should correspond to the number of columns.
e.g.
this.datagridview1.Rows.Add(new object[] { “col1”, “col2”, “col3”, 4.5, true});