System.Windows.Forms.WebBrowser.Document Property

Gets an System.Windows.Forms.HtmlDocument representing the Web page currently displayed in the System.Windows.Forms.WebBrowser control.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.Browsable(false)]
public HtmlDocument Document { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use this property when you want to access the contents of a Web page displayed in the System.Windows.Forms.WebBrowser control through the HTML document object model (DOM). This is useful, for example, when you want to use Web-based controls in your Windows Forms application.

You can use this property, in combination with the WebBrowser.ObjectForScripting property, to implement two-way communication between a Web page displayed in the System.Windows.Forms.WebBrowser control and your application. Use the HtmlDocument.InvokeScript(string, Object[]) method to call script methods implemented in a Web page from your client application code. Your scripting code can access your application through the window.external object, which is a built-in DOM object provided for host access, and which maps to an object that you specify for the WebBrowser.ObjectForScripting property.

To access the contents of a Web page as a string, use the WebBrowser.DocumentText property. To access the contents of a Web page as a System.IO.Stream, use the WebBrowser.DocumentStream property.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0