How to populate a multi-column list

I know how to create a list, but I have some problems to populate a multi-column list. How can i do this?

+4
source share
1 answer

What type of list management are you using? My first-hand choice for a multi-column list is usually a ListView, which can be populated like this:

foreach (var item in someDataList) { // create the list view item (which makes the first column) ListViewItem lvi = myListView.Items.Add(item.Text); // add additional columns lvi.SubItems.Add(item.SomeOtherValue); } 

Then you set the View property to Details and edit the Columns collection and should. and you should be good to go.

+5
source

All Articles