Mir Hussain

Mir Hussain

  • NA
  • 23
  • 8.2k

FileNotFoundException error on users computer

Mar 2 2017 11:56 PM

Hi Mr. Jitendra,

Thanks for your help provided with the code, for your info, pls find below the complete code for accessing html files from a folder on desktop. This folder I have included in insatallation setup. This program is working on my system but after insattaltion on other system it is giving FileNotFoundException i.e. some part of the path is unable to reach.

Code Snippet:

private void button1_Click(object sender, EventArgs e)

{

String dtpath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

dtpath = dtpath + @"\phy5files\";

String[] files = Directory.GetFiles(dtpath, "*.htm");

if (i < files.Length)

{

FileInfo fi = null;

try

{

fi = new FileInfo(files[i]);

webBrowser1.Navigate(fi.ToString());

i += 1;

}

catch (FileNotFoundException ee)

{

MessageBox.Show(ee.Message);

}

}

else

{

MessageBox.Show("The end");

}

}

Hope you understand my problem and will continue to guide me further.
Thanks
MIr 
 

Answers (2)