WebBrowser


The WebBrowser control displays the contents of web pages, XML documents, text files, and other documents understood by the browser. The control can automatically follow links that the user clicks in the document and provides a standard web browser context menu, containing commands such as Back, Forward, Save Background As, and Print.

Using this control, you can easily add web-based hypertext to your applications. For example, you could display an HTML help system or tutorial pages within the control.

The control provides several properties and methods for navigating to different documents. The following table describes the most useful of these.

Open table as spreadsheet

Property/Method

Purpose

Url

Gets or sets the control’s current web address.

Navigate

Makes the control open a specific URL.

GoBack

Makes the control move to the URL it previously displayed.

GoForward

After a call to GoBack, makes the control move forward to the next URL it displayed.

GoHome

Makes the control go to the current user’s home page.

GoSearch

Makes the control go to the current user’s search page.

Whenever the control moves to a new document, it fires three events. The Navigating event fires before the control moves to the new document. The Navigated event occurs after the control has navigated to the new document and is loading it. The DocumentCompleted event occurs when the control has finished loading the document.

The control also supports a variety of other events that tells a program when something has changed. Some of the more useful of these notification events include CanGoBackChanged, CanGoForward?Changed, DocumentTitleChanged, NewWindow (the browser is about to open a new window), Progress?Changed (gives progress information on the download of a document), and StatusTextChanged.

After the control loads a document, the program can manipulate the document through the control’s Document property. This property contains a reference to an HtmlDocument object that gives access to the document’s images, forms, links, and other HTML document elements.

In addition to opening existing documents, a program can make the WebBrowser display a file generated within the application by setting its DocumentText or DocumentStream properties.

The WebBrowser control provides all of the power and flexibility of Internet Explorer. Unfortunately, that power and flexibility makes the control quite complicated, so it is not described further here. Refer to the online help (msdn2.microsoft.com/library/system.windows.forms.webbrowser.aspx) for more information.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net