• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

Loading crude HTML into the WebBrowser control

Hello

How can I load crude HTML text from a ordinary textbox to the WebBrowser conntrol?

For instance, suppose I got the following HTML code in a textbox:

<HTML)
<HEAD><TITLE>Test 1</TITLE></HEAD>
<BODY>
<FONT COLOR="BLACK">Hello world!</FONT>
</BODY>
</HTML>

And now I want to put it into the WebBrowser to be showing as an HTML page... is that possible?

With the DHTMLEdit control we could do this because it had a property named "DocumentHTML" which accepts HTML code. But I can't use DHTMLEdit in this case... please help!

Thank you
0
Buchankas
Asked:
Buchankas
  • 3
  • 2
  • 2
  • +1
1 Solution
 
DocMCommented:
Hi,
WebBrowser.Navigate Filename

Regards,
0
 
BuchankasAuthor Commented:
WebBrowser.Navigate Filename

This doesn't work, as the text I want to Load isn't a file, it is some text in a textbox...
0
 
DocMCommented:
Hi,
WebBrowser.Navigate Filename

Regards,
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Éric MoreauSenior .Net ConsultantCommented:
Private Sub Form_Load()
   WebBrowser1.Navigate "about:blank"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
   WebBrowser1.Document.write _
       "<HTML><BODY bgcolor=red>This is a test.</BODY></HTML>"
End Sub
0
 
Éric MoreauSenior .Net ConsultantCommented:
Without using the Navigate or Navigate2 methods, you can
do the following:

webBrowser1.Document.body.innerHTML = "<b>html text</b>"
0
 
aelatikCommented:
WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.write Text1
0
 
BuchankasAuthor Commented:
Thank you guys! Now I can keep my work going, I was stuck in this for months!
0
 
DocMCommented:
Sorry,

WebBrowser1.Navigate "about:blank"
While WebBrowser1.Busy: Wend
Set doc = WebBrowser1.Document
doc.open

doc.write Text1.Text

WebBrowser1.Visible = True
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now