Populating WinForms Controls at Runtime with C#

Display a Winforms ListView Vertically at Runtime Using C#

A C# ListView can display row data vertically, as well as horizontally, like this:

A Sample C# ListView Displaying Row Data Vertically

h3>A Sample C# ListView Displaying Row Data Vertically

The example method below takes the first row of a DataTable and displays it vertically:

public void FillListViewVertically(ListView listView, DataTable dataTable) {
  foreach(DataColumn dataColumn in dataTable.Columns) {
    ListViewItem listViewItem = listView.Items.Add(dataColumn.ColumnName);

When using this method in your code provide the name of your ListView and your DataTable in the method's arguments, like this:

FillListViewVertically(<yourListView>, <yourDataTable>);

Next Topic