Search code examples
c#listviewimagelist

Images only showing filepaths in ListView c#


I have a list' 'imagearealist' which has a list of filepaths to images. Using a for each loop

     foreach (String item in imagearealist)
            {

                imgs.Images.Add(Image.FromFile(item));
                listView1.Items.Add(item);                
                listView1.LargeImageList = imgs;
                count++;
            }

In the listView1 box all I get is the filepath names in the centre of the box and no images. The filepath names - 'item' can load an image into a picture box but not the listView1 box. What am I doing wrong?

Many thanks Steve


Solution

  • Please test this:

    count = 0;
    listView1.LargeImageList = imgs;
    foreach (String item in imagearealist)
            {
                imgs.Images.Add(Image.FromFile(item));
                listView1.Items.Add(item, count);                
    
                count++;
            }