Thanks Mighell,
But that solution requires "writing to disk and using the .Navigate() method
to re-load the file." I've found another solution that works without
creating a file, some of the code is on the MS Website, the rest is borrowed
from Stefan Popov.
It works like this:
// dummy ref objects for Navigate call to about
:blank
object Zero = 0;
object EmptyString = "";
// HTML to display
string aString = "<HTML><BODY>This is a test</BODY></HTML>";
// Have to navigate to about
:blank first, or axWebBrowser1.Document will be
null
axWebBrowser1.Navigate("about
:blank", ref Zero, ref EmptyString, ref
EmptyString, ref EmptyString);
// Create an IHTMLDocument2
IHTMLDocument2 doc = axWebBrowser1.Document as IHTMLDocument2;
// Write the HTML to the doc
doc.writeln(aString);
// Close the doc
doc.close();
Thanks anyway,
Michael C., MCDBA
"Mighell" <mighell_TOGLI@mart3_TOGLI.it> wrote in message
news:X_*********************@twister1.libero.it...
Hello Michael, string page = "<HTML><BODY>This is a test.</BODY></HTML>";
And display the page variable's contents in the AxWebBrowser (without
writing to disk and using the .Navigate() method to re-load the file.) I had the same problem in the past.
My solution is to write the file in the system temp directory.
System.IO.Path.GetTempFileName()
returns a uniquely named zero-byte temporary file on disk and returns the
full path to that file that you can write. After write the html code, you can pass this path to the .navigate method.
Remember to delete this file when you close the application.
Any help is appreciated.
I Hope thaht this help you.
Bye
--
____________________________
Mighell (http://www.datadream.it)
Hi all,
Quick question about the AxSHDocVw.AxWebBrowser Component. I was
wondering if there is a way to view pages generated internally within
my application without writing them to disk. For instance, I'd like
to do something like the following:
string page = "<HTML><BODY>This is a test.</BODY></HTML>";
And display the page variable's contents in the AxWebBrowser (without
writing to disk and using the .Navigate() method to re-load the file.)
Any help is appreciated.
Thanks,
Michael C., MCDBA