I have mafe a simple object using fileInfo
class as:
DirectoryInfo myDirectory = new DirectoryInfo(@"d:\Books");
FileInfo[] files = myDirectory.GetFiles();
foreach (FileInfo file in files)
{
try
{
file.OpenRead();
break;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
The first file in the directory(Books) is PDF
. The code throw no exception. Still the particular file doesn't open. what code i am missing or i am doing any error. Thanks for any assistence.