Add Data to a ListView : ListView : GUI Windows Form C# Source Code


Custom Search

C# Source Code » GUI Windows Form » ListView »

 

Add Data to a ListView








    


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());
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo GUI Windows Form
» ListView