I'd like to know if it possible to show HTML page created in VB using WebBrowser object without using files on di开发者_运维技巧sk. That is, create HTML file in memory and show it within WebBrowser object. Thanks!
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
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.
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.
精彩评论