I made a form into Visual Studio (Window forms) and i used a webbrowser from toolbox.

I want to open into the webbrowser a web page from local drive. In properties, into the URL box if I write the absolute path (ex. c:\xy.htm) it works, but how i can use a relative path (ex. the page is into the same folder with the executable file) ?

I try .\xy.htm but it didn't worked. Any ideas ??

Thanks in advance !

You can not use relative paths in the WebBrowser.
But you can find the path of the executable by using Application.ExecutablePath.

string folder = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
string url = System.IO.Path.Combine(folder, "xy.htm");

Thanks for your help, but can you be more analytic ?

I am new on C# ...

I try the following code, but it didn't work:

string filePath = @".\xyz.htm";
      string folder = System.IO.Path.GetDirectoryName(filePath);
      string url = System.IO.Path.Combine(folder, "xyz.htm");

I made it !

I use the following code:

string startPath = Application.StartupPath;
string filepath = System.IO.Path.Combine(startPath, "xyz.htm");
webBrowser1.Navigate(new Uri(filepath));

Thanks for your help !