7

I'd like to know if it possible to show HTML page created in VB using WebBrowser object without using files on disk. That is, create HTML file in memory and show it within WebBrowser object. Thanks!

3 Answers 3

4

Using Visual Basic in .Net Framework...

webBrowser1.DocumentText = "<html><body><a href='http://www.mywebsite.com'>My Web Site</a></body></html>"

In old Visual Basic 6, try...

WebBrowser1.Document.Open
WebBrowser1.Document.Write "<html><body><a href='http://www.mywebsite.com'>My Web Site</a></body></html>"
WebBrowser1.Document.Close
Sign up to request clarification or add additional context in comments.

Comments

2

First wait for the DocumentComplete event (navigate to about:blank if you start from scratch), then use the document's IPersistMoniker (recommended if you want to provide a base url) or IPersistStreamInit interface to load HTML content.

You can find an example (the LoadHtmlIntoBrowser method) in the csexwb project.

1 Comment

Your load HTML content link is death.
0

Well, I've found the solution. It's not so complicated. The solution is to run from the VB: *

  • WebBrowserObject.Navigate "about:HTML TEXT"
  • It works, I've checked it.

1 Comment

There is a length limit on urls.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.