473,722 Members | 2,266 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 12007
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
2770
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
3811
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
3583
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
25846
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
6374
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
8714
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
1385
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
1185
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
2616
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
9382
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...
1
9154
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
9087
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8043
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...
1
6681
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4502
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...
1
3207
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
2
2601
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
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.