473,587 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting html code in axwebbrowser

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.Reflecti on.Missing.Valu e;
wbb.Navigate("a bout:blank", ref o, ref o, ref o, ref o);
while (wbb == null) Application.DoE vents();
mshtml.HTMLDocu ment doc = (mshtml.HTMLDoc ument)wbb.Docum ent;
doc.body.innerH TML = "...(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!
Nov 16 '05 #1
2 1833
Try to write the code in DocumentComplet e Event

Nirosh.

"Dan" <df***@hotmail. com> wrote in message
news:O8******** ******@TK2MSFTN GP10.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.Reflecti on.Missing.Valu e;
wbb.Navigate("a bout:blank", ref o, ref o, ref o, ref o);
while (wbb == null) Application.DoE vents();
mshtml.HTMLDocu ment doc = (mshtml.HTMLDoc ument)wbb.Docum ent;
doc.body.innerH TML = "...(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!

Nov 16 '05 #2
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.Reflecti on.Missing.Valu e;
wbb.Navigate("a bout:blank", ref o, ref o, ref o, ref o);
while (wbb == null) Application.DoE vents();


wbb is never "null". Use wbb.Document or see Nirosh's answer.

bye
Rob
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2917
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, all attributes are unquoted. Despite the fact that the sourcecode that was input into the browser component had lowercase HTML tags and quoted...
27
8343
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 HTML it needs to display. I've already spent way too much time trying to get the Microsoft WebBrowser control to work, and I have too many other things...
0
1320
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 resource DLL with all the HTML pages then calling axWebBrowser.Navigate("res://mydll.dll/home.htm" ref 0, ref 0, ref 0, ref 0)) and not being able to...
0
264
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 resource DLL with all the HTML pages then calling axWebBrowser.Navigate("res://mydll.dll/home.htm" ref 0, ref 0, ref 0, ref 0)) and not being able to...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8347
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6626
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3844
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1189
bsmnconsultancy
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.