Hi, i have this code snippet
private List<string> FolderOne(string Folder)
{
string filena;
DirectoryInfo dir = new DirectoryInfo(Folder);
FileInfo[] files = dir.GetFiles("*.mp3", SearchOption.AllDirectories);
List<string> str = new List<string>();
foreach (FileInfo file in files)
{
str.Add(file.FullName);
filena = file.FullName;
filena.Replace("*.mp3", "*.jpg");
if (filena.Length > 0)
{
pictureBox1.Image = new System.Drawing.Bitmap(filena.ToString()); //I receive a error "Parameter is not valid."
}
}
return str;
}
My purpose was to make read the picture box the file.fullname ".mp3" in the same folder but end with ".jpg",infact i have 2 file in a folder the first one is a song "firstsong.mp3" and the second one a picture "firstsong.jpg" the difference between them is the final extension so i try to make read to picturebox the same filename but with extension ".*jpg" and i receive an error "Parameter is not valid." in the line code "pictureBox1.Image = new System.Drawing.Bitmap(filena.ToString());". How i can work out that? Thanks for your attention
Nice Regards