ListViewItem item = new ListViewItem("Item 1");
// Load an icon file into a Bitmap object Bitmap icon = new Bitmap("icon.bmp"); // Create the ListViewItem with text and icon ListViewItem item = new ListViewItem("Item 2", 0); item.ImageIndex = imageList1.Images.Add(icon, Color.Transparent);
ListViewItem item = new ListViewItem("Item 3"); item.SubItems.Add("Sub-Item 1"); item.SubItems.Add("Sub-Item 2");In all of these examples, the ListViewItem class is used to represent an item in a ListView control. This class is a part of the System.Windows.Forms namespace in the Windows Forms library.