5
Reply

add image from folder to a list

Violeta Popa

Violeta Popa

Apr 8 2013 3:55 PM
1k
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)