Wednesday, January 4, 2012

Read Local HTML file into a web browser control

// Nigel Notes: this is a little tricky as you have to read the file first into a variable
// and then utilize that
// I am mainly going to utlize this to parse XML into a locally stored web page
// Make it look aesthetic, and then present it through the webbrower control
// TextFile1.html in my case is content type and in the flat out root folder of the app.

var rs = Application.GetResourceStream(new Uri("TextFile1.html", UriKind.Relative));
StreamReader sr = new StreamReader(rs.Stream);
string html = sr.ReadToEnd();

//Uri myURI;
//myURI = new Uri ("TextFile1.html",UriKind.Relative);
webBrowser1.NavigateToString(html);

No comments:

Post a Comment