ListView.Items : ListView « System.Windows.Forms « C# / C Sharp by API






ListView.Items

 


using System;
using System.Windows.Forms;
using System.IO;

public class TagPropertyExample : System.Windows.Forms.Form {
    ListView listView = new ListView();
    
    public TagPropertyExample () {
        listView.Left = 10;
        listView.Top = 10;
        
        listView.Size = new System.Drawing.Size(292, 273);
        DirectoryInfo directory = new DirectoryInfo("C:\\");
        FileInfo[] files = directory.GetFiles();

        foreach (FileInfo file in files) {
            ListViewItem item = listView.Items.Add(file.Name);
            item.ImageIndex = 0;
            item.Tag = file;
        }
        this.Controls.Add(listView);
    }


    public static void Main(){
       Application.Run(new TagPropertyExample());
    }
}
           

   
  








Related examples in the same category

1.extends ListView
2.ListView.Click
3.ListView.ColumnClick
4.ListView.DragDrop
5.ListView.ItemActivate
6.ListView.LargeImageList
7.ListView.MouseUp
8.ListView.Sorting
9.ListView.View