?
Solved

Loading crude HTML into the WebBrowser control

Posted on 2003-03-30
8
Medium Priority
?
283 Views
Last Modified: 2010-04-07
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
Comment
Question by:Buchankas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 3

Expert Comment

by:DocM
ID: 8235145
Hi,
WebBrowser.Navigate Filename

Regards,
0
 

Author Comment

by:Buchankas
ID: 8235165
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
 
LVL 3

Expert Comment

by:DocM
ID: 8235170
Hi,
WebBrowser.Navigate Filename

Regards,
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8235177
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
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 260 total points
ID: 8235180
Without using the Navigate or Navigate2 methods, you can
do the following:

webBrowser1.Document.body.innerHTML = "<b>html text</b>"
0
 
LVL 14

Expert Comment

by:aelatik
ID: 8235188
WebBrowser1.Navigate "about:blank"
WebBrowser1.Document.write Text1
0
 

Author Comment

by:Buchankas
ID: 8235221
Thank you guys! Now I can keep my work going, I was stuck in this for months!
0
 
LVL 3

Expert Comment

by:DocM
ID: 8235237
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question