Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listview Details view not displaying anything

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);
like image 757
Kurru Avatar asked Mar 27 '11 18:03

Kurru


1 Answers

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.

like image 106
Kurru Avatar answered Oct 18 '22 18:10

Kurru