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

Recommended Answers

All 8 Replies

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");

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.

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

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.

Thanks Rhats great !!

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

Help me...

Navigate is used with Uris, use this instead:

string html = "<html><body><strong>HelloWorld!</strong></body></html>";
Browser.DocumentText = html;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.