N

N

  • NA
  • 5
  • 0

how catch this error ??

Oct 14 2006 12:15 PM
i use a treeview sample that i have created and want to load the files that i have made
here is an example

void TreeView1AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)

{

string x = e.Node.Text ;

switch(x)

{

case"Node1":

webBrowser1.Navigate (@"\s.html"); ////this works fine

webBrowser2.Navigate (@"\x.html"); ///this works fine too

break;

case"Node2":

webBrowser1.Navigate (@"\s.html"); ////this works fine
webBrowser2.Navigate (@"\x.htmlx"); ///i dont have this file becouse i want to create an error !!
 
i want to catch this error and it must load an empy file of or navigate to ("")
if the file does not exist then dont wat a messagebox with error etc etc...only load an empty file if the file does not exist.visa versa for webbrowser1.navigate(@"\s.html");

break;

}



i can't vigerout how to  solf this problem.
i have try this

if (webbrowser.Document != null)
this does not work becouse it looks only if  document is loaded or not.
i have tryd many if and else statements  and try and catch bloks nothing works.
please help.

thanks

Answers (4)