473,606 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

feeding HTML in a string to the WebBrowser control

I would like to build an HTML stream as a string and have the
WebBrowser control render that HTML. Then on PostBack, or whatever it
is called, I would like my code to be the one that receives what the
WebBrowser control is sending. Effectively, my code would be the web
server and the WebBrowser control would be the web client.

All the examples I am seeing have the WebBrowser control being directed
to a URL from which to get the HTML document to render.

I have tried to set the InnerHtml property but got an error saying the
WebBrowser.Docu ment was null. How can I set the InnerHtml of the
control without having to first set the URL property?

thanks,

-Steve

Jan 2 '07 #1
4 11994
why do you want to use the web browser control? why dont u just use the form
to provide this interface?
Jan 2 '07 #2
Have you tried to write to the browser.Documen t.Write(strHTML ) ?

"Steve Richter" <St************ @gmail.comwrote in message
news:11******** **************@ h40g2000cwb.goo glegroups.com.. .
>I would like to build an HTML stream as a string and have the
WebBrowser control render that HTML. Then on PostBack, or whatever it
is called, I would like my code to be the one that receives what the
WebBrowser control is sending. Effectively, my code would be the web
server and the WebBrowser control would be the web client.

All the examples I am seeing have the WebBrowser control being directed
to a URL from which to get the HTML document to render.

I have tried to set the InnerHtml property but got an error saying the
WebBrowser.Docu ment was null. How can I set the InnerHtml of the
control without having to first set the URL property?

thanks,

-Steve
Jan 2 '07 #3

Ryan wrote:
Have you tried to write to the browser.Documen t.Write(strHTML ) ?
thanks. I still got the "document is null" exception.

update:
I assigned to DocumentText and that worked!:
webBrowser1.Doc umentText = "xxxx" ;

in general, how do I new up a WebBrowser.Docu ment object?

-Steve
here is the code:

namespace demo_WebBrowser
{
public partial class Form1 : Form
{
public Form1()
{
InitializeCompo nent();
webBrowser1.Doc umentText = "xxxx" ;
webBrowser1.Doc ument.Write("<h 1>Hello World!</h1>");
}
private void webBrowser1_Doc umentCompleted( object sender,
WebBrowserDocum entCompletedEve ntArgs e)
{
}
}
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.webBrowser 1 = new System.Windows. Forms.WebBrowse r();
this.SuspendLay out();
//
// webBrowser1
//
this.webBrowser 1.Dock = System.Windows. Forms.DockStyle .Fill;
this.webBrowser 1.Location = new System.Drawing. Point(0, 0);
this.webBrowser 1.MinimumSize = new System.Drawing. Size(20, 20);
this.webBrowser 1.Name = "webBrowser 1";
this.webBrowser 1.Size = new System.Drawing. Size(827, 363);
this.webBrowser 1.TabIndex = 0;
this.webBrowser 1.DocumentCompl eted += new
System.Windows. Forms.WebBrowse rDocumentComple tedEventHandler (this.webBrowse r1_DocumentComp leted);
//
// Form1
//
this.AutoScaleD imensions = new System.Drawing. SizeF(6F, 13F);
this.AutoScaleM ode = System.Windows. Forms.AutoScale Mode.Font;
this.ClientSize = new System.Drawing. Size(827, 363);
this.Controls.A dd(this.webBrow ser1);
this.Name = "Form1";
this.Text = "WebBrowser Control Demo";
this.ResumeLayo ut(false);
}

>
"Steve Richter" <St************ @gmail.comwrote in message
news:11******** **************@ h40g2000cwb.goo glegroups.com.. .
I would like to build an HTML stream as a string and have the
WebBrowser control render that HTML. Then on PostBack, or whatever it
is called, I would like my code to be the one that receives what the
WebBrowser control is sending. Effectively, my code would be the web
server and the WebBrowser control would be the web client.

All the examples I am seeing have the WebBrowser control being directed
to a URL from which to get the HTML document to render.

I have tried to set the InnerHtml property but got an error saying the
WebBrowser.Docu ment was null. How can I set the InnerHtml of the
control without having to first set the URL property?

thanks,

-Steve
Jan 2 '07 #4

XOR wrote:
why do you want to use the web browser control? why dont u just use the form
to provide this interface?
how would I render the HTML?

thanks,

-Steve

Jan 2 '07 #5

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

Similar topics

5
2761
by: Charles Law | last post by:
Sorry for the cross post, but I'm not sure who is best placed to answer this one. This is the most bizarre behaviour of MSHTML and streams. I have a WebBrowser control that contains nothing but some default HTML. I want to copy the document and modify it before saving it to disk. So, I clone the document like this:
9
3798
by: ASP .NET Newbie | last post by:
How can I run a WebBrowser control using ASP.NET/VB.NET? I know I can use the WebClient to get the page data, but I need to be able to use the WebBrowser (AxWebBrowser)? Thanks, Chad
6
3578
by: Tiraman | last post by:
Hi, i have some html string and i would like to display it like the web browser does. what is the best way to do it ? Best Regards , Tiraman :-)
9
25828
by: Jason Boardman | last post by:
Can anyone tell me how I can write HTML to a WebBrowser control in Visual Basic 6? I want to display HTML in the browser that is generated from within my VB program (as opposed to loading it from a file or URL). Is this possible? Jason
12
6349
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but of course it's thrown up a whole host of new issues... I'm generating a multi page printable document in HTML from my app, and displaying it in a WebBrowser control. I've looked into using some CSS
11
8702
by: Webbert | last post by:
I am trying to display XML in a WebBrowser Control. I receive a data feed of XML and am trying to inject it into the control. I have not been successful in doing so. The only solution I have found is to write it to a temp file and then use the Navigate method to load it. As the control is capable of loading it from disk, I would like to find a way to skip the save/load and just inject. Thanks, Dave
0
1371
by: Balex | last post by:
hi, I have a VB.Net app which "reads" in html pages from a web server using winhttp. The purpose is for the app to "fill in" data fields on the page, then send it back to the web server, as if a user had been entering the data in his web browser. It's part of a data input automation project. I'd like, for my own testing, to show the pages I am accessing. So I added a webBrowser control to my main form, I have the html sent by the server...
0
1180
by: ranjanmondal | last post by:
I can access ( read/put ) value into the textbox of an html through webbrowser control in vb ( using document.getElementById("elementName"). But some time I notice that the element(textbox) in present into another html within a frame and I can't be open directly. ..................Main.html.............. <frameset ..... > <frame serc="empty.html> <frame src=another.html> </frameser> <noframeset> <html><body> kjfaklsjllj </body></html>...
0
2606
by: overbrain | last post by:
Hello guys. I want to create a HTML on webbrowser control with zoom button. Is it possible in VB.NET?
0
8045
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8467
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8462
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8127
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6803
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3952
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1315
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.