0
Answer

Creating .exe file containing app data + PictureBox problem

roy doron

roy doron

11y
1.3k
1
Hello Everyone,

I have two problems with my Winforms application.

In my app im reading from a folder that contains 1000 photos.

1. Each time Im running my app, I programed it to read the photos stored in a specific folder and put them in a DB (Dictionary<string, Image>), using:
            dI = new DirectoryInfo(@"C:\Users\Me\Desktop\Photos");
            fileInfos = dI.GetFiles("*.jpg", SearchOption.TopDirectoryOnly);
            foreach (FileInfo fi in fileInfos)
            {
                DB.Add(Path.GetFileNameWithoutExtension(fi.FullName), Image.FromFile(fi.FullName));
            }

but when im trying to place a photo in a pictureBox using:
pictureBox4.BackgroundImage =  DB["PhotoName"];

It shows nothing, blank.

that's a drawback, CAUSE,

2. I want to use this app in other computers using only the .exe file that stored in the ..\bin\debug\
without each time changing the path the photos are stored...

So, how do I create an .exe file for my app that already has all the photos? without worring about them? (problem no' 2)

And, how to make sure the photos are shown (problem no' 1)

Thank you all!