I'd like to display some HTML code in a form using the axwebbrowser control,
without having to create a temporary file to navigate to. I'm trying the
following code (let's say that the web browser control is named wbb):
object o = System.Reflection.Missing.Value;
wbb.Navigate("about:blank", ref o, ref o, ref o, ref o);
while (wbb == null) Application.DoEvents();
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)wbb.Document;
doc.body.innerHTML = "...(my html code)...";
here the last line of code throws an exception as doc.body is null, even if
I have forced the control to navigate to the blank page to avoid this.
What's the correct way of setting the HTML code of a webbrowser control?
Thanks guys! 2 1829
Try to write the code in DocumentComplete Event
Nirosh.
"Dan" <df***@hotmail.com> wrote in message
news:O8**************@TK2MSFTNGP10.phx.gbl... I'd like to display some HTML code in a form using the axwebbrowser
control, without having to create a temporary file to navigate to. I'm trying the following code (let's say that the web browser control is named wbb):
object o = System.Reflection.Missing.Value; wbb.Navigate("about:blank", ref o, ref o, ref o, ref o); while (wbb == null) Application.DoEvents(); mshtml.HTMLDocument doc = (mshtml.HTMLDocument)wbb.Document; doc.body.innerHTML = "...(my html code)...";
here the last line of code throws an exception as doc.body is null, even
if I have forced the control to navigate to the blank page to avoid this. What's the correct way of setting the HTML code of a webbrowser control?
Thanks guys!
Hi Dan, I'd like to display some HTML code in a form using the axwebbrowser control, without having to create a temporary file to navigate to. I'm trying the following code (let's say that the web browser control is named wbb):
object o = System.Reflection.Missing.Value; wbb.Navigate("about:blank", ref o, ref o, ref o, ref o); while (wbb == null) Application.DoEvents();
wbb is never "null". Use wbb.Document or see Nirosh's answer.
bye
Rob This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: panik |
last post by:
Hi,
retreiving the source code from an instance of the AxWebBrowser component,
using getBody(), through an IHTMLDocument2 object, makes the sourcode look
very bad:
All tags are in uppercase,...
|
by: Michael C |
last post by:
Anyone know of a good HTML Rendering control? I need a control that will
render and display HTML in a Windows form. It doesn't need to pull down
HTML pages from the Web - I'll feed it all the...
|
by: thompson_38 |
last post by:
What is the difference between calling a HTML page stored on the local
machine (axWebBrowser.Navigate("home.htm" ref 0, ref 0, ref 0, ref
0)) and being able to access a frame, to creating a...
|
by: thompson_38 |
last post by:
What is the difference between calling a HTML page stored on the local
machine (axWebBrowser.Navigate("home.htm" ref 0, ref 0, ref 0, ref
0)) and being able to access a frame, to creating a...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |