Listview layout probmems

bonedoc
06-10-2006, 01:40 AM
For some reason when I add items to my listview, they are added left to right. It is just a stock listview. Why would this happen?

listview1.items.add("Test")

jo0ls
06-10-2006, 06:33 AM
Change the View property to details or list.

bonedoc
06-12-2006, 08:15 PM
Change the View property to details or list.
Thanks, That worked. I do have one problem, however. I ckear the listview with:

Listview1.Clear()

After this, I create another listview in its place witht the same:

Listview1.Add("Item")

For some reason, it looses the view.small layout....even if I put it in the code after the clear(). Do you know what would cause this? Am I clearing the listview wrong?

Allen G
06-13-2006, 02:16 AM
Public Sub Clear()
Member of: System.Windows.Forms.ListView
Summary:
Removes all items and columns from the control.



Public Overridable Sub Clear()
Member of: System.Windows.Forms.ListView.ListViewItemCollection
Summary:
Removes all items from the collection.


So when using listView.Clear you're removing all of your columns aswell as your items. Basicly reseting it back to default.

What you want to use is listView.Items.Clear, which only removes the items and will preserve your column headers.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum