webBrowser1.Navigate(@"C:\index.html");
webBrowser1.Navigate(Application.StartupPath + @"\index.html");
Just navigate to the HTML file.
i.e.
Code:webBrowser1.Navigate(@"C:\index.html");
If you wanted something in the same directory as your browser application,
Code:webBrowser1.Navigate(Application.StartupPath + @"\index.html");
The '@' simply denotes that it is a path, so escape characters are ignored, and backslashes are used to separate the directories. You can always use forward slash, I guess it depends on your coding habits.
yeah that's right, it has a url property, but I have tried to add the path but it doesn't work :/I think the WebBrowser control actually has a property called "Url" which you can set, and the browser loads the page at "Url" on startup.
webBrowser1.Navigate(Application.StartupPath + @"\index.html");
You could store the entire HTML file in to a hardcoded string, then create a temporary file from that string and navigate to it.ok.. this code works, but I have to have a folder with all the htlm files in at the same place as the .exe file... what I wanted was to have the thml files build in to the exe file... I don't know if that is possible but if someone finds out how to do it please post here or pm me![]()
Code:webBrowser1.Navigate(Application.StartupPath + @"\index.html");
what do you mean with "Hardcoded string"? what is it, could you please explain a little more?You could store the entire HTML file in to a hardcoded string, then create a temporary file from that string and navigate to it.
StreamWriter sw = new StreamWriter(Application.StartupPath + "/page.html");
sw.Write(data);
sw.Close();
WebBrowser.Navigate(Application.StartupPath + "/page.html");
You would use file I/O classes in the System.IO namespace (or something similar).
e.g.
Code:StreamWriter sw = new StreamWriter(Application.StartupPath + "/page.html"); sw.Write(data); sw.Close(); WebBrowser.Navigate(Application.StartupPath + "/page.html");
Not sure if that will work - I just typed it up in the reply box.

