Hi,
i have tabcontrol containing two tabPages. One of the tabPage contains a ListView with dock property set to FILL. if i leave the default view for the ListView.view property alone, i see the items i added (though not the way i want them to appear), but if i change the view to DETAIL, i see nothing. Anyone have any idea why this is happening
so if i have:
this.ctlLv.View = View.Details; ListViewItem lvi = new ListViewItem( "Dell" ); ctlLv.Items.Add( lvi ); |
i do not see anything in the list view. but if i comment out the first line, i do.

ListView problem
Mac.
Did you set your ColumnHeader width Because if the ColumnHeader width is 0 you won't see your item as well. You can try to resize the ColumnHeader and see if you can see the list view item.
I've tried the following code and it display the listview item correctly.
private void Form1_Load(object sender, EventArgs e)
{
this.listView1.View = View.Details;
ListViewItem lvi = new ListViewItem("Dell");
ListViewItem.ListViewSubItem lvs = new ListViewItem.ListViewSubItem();
lvs.Text = "Dell Corp";
lvi.SubItems.Add(lvs);
this.listView1.Items.Add(lvi);
ColumnHeader ch = new ColumnHeader();
this.listView1.Columns.Add(ch);
ch.Width = 50;
}
AmitJ
SteveJessup
please not also, although i have not shown it in the code snippet above, i am adding the columns using ColumHeader object and calling ctlLV.columns.add( columnHeader).
I am trying this in Visual Studio 2005 beta 2
richfu
and upon further inspection, the reason for this order is due to a bug in my code. in my function that populates the listview,
instead of,
this.ctlLv.Clear();
i should have written,
this.ctlLv.Items.Clear();