Get the file Name From the Folder in C#
folderPath = "E:\\video-app\\SamplePics";// Here you can set your folder path (SamplePics contain lot of images i want image name one by one) and show it in messagebox
foreach (var file in Directory.GetFiles(folderPath))
{
string[] pathArr = file.Split('\\');
string[] fileArr = pathArr.Last().Split('.');
string fileName = fileArr.First().ToString();
MessageBox.Show("" + fileName);
}
folderPath = "E:\\video-app\\SamplePics";// Here you can set your folder path (SamplePics contain lot of images i want image name one by one) and show it in messagebox
foreach (var file in Directory.GetFiles(folderPath))
{
string[] pathArr = file.Split('\\');
string[] fileArr = pathArr.Last().Split('.');
string fileName = fileArr.First().ToString();
MessageBox.Show("" + fileName);
}
No comments:
Post a Comment