How to read images from a given folder using C#? I want to display those images into a PictureBox.

Recommended Answers

All 3 Replies

>How to read images from a given folder using C#?

pic.Image = Image.FromFile("filepath");

Just to clarify, you say you want to load "images" (plural) into a picturebox (singular). What were you hoping to achieve? If you wanted to load more than one image you can use a foreach loop:

foreach (string file in Directory.GetFiles(@"C:\Pictures", "*.jpeg", SearchOption.AllDirectories))
                {

                }

But you would need some way to cycle the display or add additional pictureboxes

i used it for a slideshow from a folder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.