tags:

views:

1692

answers:

4

On the .Net WebBrowser control the only way I can see to load a page to it is to set the URL property. But I would like to instead give it some HTML code that I already have in memory without writing it out to a file first. Is there any way to do this? Or are there any controls that will do this?

+5  A: 

You want the DocumentText Property:

http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext.aspx

?

mspmsp
Exactly what I needed. Thanks!
Adam Haile
A: 

Also, generally, anywhere you can use a Stream, you can use MemoryStream to wrap data you have in memory.

Lou Franco
+1  A: 

You use either WebBrowser.DeocumentText (http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext.aspx) or WebBrowser.DocumentStream (http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentstream.aspx) to change the HTML in the current document. You might need to navigate to about:blank, if you don't have a document.

Franci Penov
A: 

Hi, I had a problem with the webbrowser control. My scenario is as following. I am displaying my html content into a web browser control using document stream. I need to navigate with in the document stream (means navigating to "Top", "Bottom" of the web browser control etc..) means like intrapage hyperlinks in a html page. constraints: I must not create .html file. I must be able to navigate with in the web browser control

Need it urgently..

Regards, Sabari.

Welcome to stackoverflow - you've posted an answer which is actually a question. Not only that, this question is "answered" so you will get few responses.Post your question as a question!
Paul Dixon