更新:2007 年 11 月
向 Windows 窗体 ListView 控件添加项的过程主要包括指定该项以及为该项分配属性。可在任何时候添加或移除列表项。
以编程方式添加项
- 
' Adds a new item with ImageIndex 3 ListView1.Items.Add("List item text", 3)// Adds a new item with ImageIndex 3 listView1.Items.Add("List item text", 3);// Adds a new item with ImageIndex 3 listView1.get_Items().Add("List item text", 3);
以编程方式移除项
- 使用 Items 属性的 RemoveAt 或 Clear 方法。RemoveAt 方法移除一项,而 Clear 方法移除列表中的所有项。 - ' Removes the first item in the list. ListView1.Items.RemoveAt(0) ' Clears all items: ListView1.Items.Clear()- // Removes the first item in the list. listView1.Items.RemoveAt(0); // Clears all the items. listView1.Items.Clear();- // Removes the first item in the list listView1.get_Items().RemoveAt(0);