954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Display a html file on a form

I need a control to put on a window form to show a web page from a url.
Is there such a control in the .net framework.

Thanks

yda
Newbie Poster
3 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

Hi,
yeah, you can use the "webBrowser" component. If you don't have this component in your toolbox, just click on the empty place on your toolbox with right mouse button, then "Choose items" and choose the "webBrowser" component. That's how it is in Visual Studio 2005, but I think it'll be quite similar in VS .net, too.

Example:

webBrowser1.Navigate("www.microsoft.com");

Stivi
Light Poster
26 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Just a note, the webbrowser control is in fact an ecapsulation of the Internet Explorer browser. This allows you to do some unique things. For example, the html you display could contain hyperlinks, and you can overload the Navigate event. So when a user clicks a hyperlink, instead of navigating, you can do whatever you like.

One application I wrote was to display PDF phone statements, with live hyperlinks (I used PostScript and pdfMark programming to create the PDFs w/ hyperlinks).

The PDF was displayed in a web browser control on a windows form. When the call center operator clicked on a given line in the statement, the code captured that event and link to run a query, popping up the call details in a new window.

This let the phone company use the PDF of the exact statement the customer recieved, as an interface back to call data.

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 

Thanks but if Im using VS.NET 2003
what can I do ?

yda
Newbie Poster
3 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

Use can use Web Broser control in VS.NET 2003 too,
Right click on Toolbox, select Customize, select COM Components tab, look for Microsoft Web Browser.

Tiendq
Newbie Poster
2 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Thanks Rhats great !!

yda
Newbie Poster
3 posts since May 2005
Reputation Points: 10
Solved Threads: 0
 

I'm using webBrowser in VS.NET 2003 but I donn't understand: It read html from Database --> display?
Now,I read html from Database after I write file (ex: index.html --> webBrowser1.Navigate("index.html"); ) but windows 7 don't support write.
who have otherwise? Help me...
Thank you very much

ttvnth
Newbie Poster
2 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

Help me...

ttvnth
Newbie Poster
2 posts since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

Navigate is used with Uris, use this instead:

string html = "<html><body><strong>HelloWorld!</strong></body></html>";
Browser.DocumentText = html;
PierlucSS
Junior Poster
187 posts since Feb 2010
Reputation Points: 65
Solved Threads: 30
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You