Displaying HTML in webbrowser control
If I added some HTML to say, Text1.Text and then create a command button that would add the html from Text1 TO Webbrowser and display it, how would I do that?
I've tried everything:
WebBrowser1 = Text1.Text
WebBrowser1.Document.Body.innerHTML = Text1.Text
Any idea?
Thanks a lot!
Paul
Re: Displaying HTML in webbrowser control
I'm fairly sure you have to save it to a temp file, and then navigate to the temp file.
Could be wrong.
Re: Displaying HTML in webbrowser control
yea u have to save the file as .html like you would with notepad or web editor then use the address of the file C://file.html or wot ever.
to my small knowledge u carnt do wot ur asking.
I finaly gave something back to this site
Re: Displaying HTML in webbrowser control
:) no you do not have to do that...
Im working on a large tutorial on my website... click HERE to check it out
but here is how you would do that...
VB Code:
Private Sub Form_Load()
WebBrowser1.Navigate "about:blank"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If (pDisp Is WebBrowser1.Application) Then
If URL = "about:blank" Then
WebBrowser1.Document.write "<HTML>HTML GOES HERE</HTML>"
End If
End If
End Sub
Re: Displaying HTML in webbrowser control
Try this ...
Private Sub Form_Load()
Dim sHTML as String
sHTML = <your html code>
WebBrowser.Navigate "about:" & sHTML
End Sub
I'm not sure if it works all the time; but yeh, it worked this time!! ;)