I am getting more and more enthusiastic about programming with C# in Visual Studio and I am trying to finalize a quiz that I made, so that it's exportable.
I had a working version which referenced images dynamically to a static location, but I am struggling to adjust this to extract from the resources folder now. I hope someone can help me out.
I have buttons on my form, which set the string
categoriesto a certain category (countries, flags, music) and the integerimagecounterto 0.I have images named after the categories which then show up from that category when the quiz is started and cycle through it with the
imagecounter.
pictureBox1.ImageLocation = "C:\\Users\\Thijs\\Desktop\\quiz-map\\" + categories + imagecounter + ".jpg";
imagecounter++;
This works perfectly fine, but sharing the solution with friends, I want it to pull the images from the resource file. I have added all images there, but am not able to cycle through the images in the same way:
pictureBox1.Image = Properties.Resources. + category + imagecounter;
How can I make this work?
I can't seem to make use of the same reference to cycle through the images and tried some different ways of notation, but can't seem to find the way to make this happen.
Thanks to Ralf's suggestions I managed to fix the above by using the following:
Thank you so much!