i'm a newbie in C# programming language. Can anybody help me on how to retrieve image from multiple folder which image at folder>folder>folder>image. Below is code that I already try but it only retrieve image if folder>image. I have try like this one string baseFolder = @"\\\\egmnas01\\hr\\photo\\~";
but still not work. Please somebody help me. Thanks.
string baseFolder = @"\\\\egmnas01\\hr\\photo\\";
string[] employeeFolders = Directory.GetDirectories(baseFolder);
string imgName = textBoxEmplNo.Text + ".jpg";
bool fileFound = false;
foreach (var folderName in employeeFolders)
{
var path = Path.Combine(folderName, imgName);
if (File.Exists(path))
{
pictureBox1.Visible = true;
pictureBox1.Image = Image.FromFile(path);
fileFound = true;
}
}
if (!fileFound)
{
pictureBox1.Visible = true;
pictureBox1.Image = Image.FromFile(@"C:\Users\jun\Desktop\images\photo\No-image-found.jpg");
}