Violeta Popa

Violeta Popa

  • NA
  • 137
  • 163.7k

add image from folder to a list

Apr 8 2013 3:55 PM
Hi :) I have a folder which contains several images and a list<image>. I want to add in the list, the images from the folder, and everytime i add a new image in the folder, to be added in the list. Some ideas? thanks!

I've tried this ;))

 string path="C:\\Users\\Vio\\Desktop\\Gestiune asigurari auto\\imagini";
            string[] jpg = Directory.GetFiles(path, "*.jpg", SearchOption.AllDirectories);
            string[] png = Directory.GetFiles(path, "*.png", SearchOption.AllDirectories);
            string[] bmp = Directory.GetFiles(path, "*.bmp", SearchOption.AllDirectories);
            string[] gif = Directory.GetFiles(path, "*.gif", SearchOption.AllDirectories);
            int total=jpg.Length+png.Length+bmp.Length+gif.Length;
            Image[] image;

            List<Image> images = new List<Image>();

            for (int i = 0; i < total; i++)
            {
                images.Add(image[i]);
            } but :-??

Answers (5)