I'm trying to use a details view mode of a ListView in winforms, but none of the items are displaying. The listview itself is growing as items are added, but nothing is being displayed.
It is displaying the items in list mode, but just not in Details mode.
I have used the following code, any ideas?
forms_listView.Columns.Add("URL");
forms_listView.Columns.Add("Position");
and
ListViewItem lvi = new ListViewItem();
lvi.Tag = form;
lvi.Text = form.URL;
lvi.Name = "URL";
ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem(lvi, "Position");
subItem.Name = "Position";
subItem.Text = ""+form.Position;
lvi.SubItems.Add(subItem);
forms_listView.Items.Add(lvi);
I found my problem. I was calling the listview.Clear()
method which in the documentation says that it removes all items and all columns, which was causing no items to be displayed.