Rediger

Del via


WebBrowser.DocumentStream Property

Definition

Gets or sets a stream containing the contents of the Web page displayed in the WebBrowser control.

public:
 property System::IO::Stream ^ DocumentStream { System::IO::Stream ^ get(); void set(System::IO::Stream ^ value); };
[System.ComponentModel.Browsable(false)]
public System.IO.Stream DocumentStream { get; set; }
[System.ComponentModel.Browsable(false)]
public System.IO.Stream? DocumentStream { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.DocumentStream : System.IO.Stream with get, set
Public Property DocumentStream As Stream

Property Value

A Stream containing the contents of the current Web page, or null if no page is loaded. The default is null.

Attributes

Exceptions

This WebBrowser instance is no longer valid.

A reference to an implementation of the IWebBrowser2 interface could not be retrieved from the underlying ActiveX WebBrowser control.

Remarks

Use this property to load a Web page into the WebBrowser control from a Stream object. You can use this property, for example, to load Web pages from a database or resource file. When you set this property, the WebBrowser control automatically navigates to the about:blank URL before loading the specified text. This means that the Navigating, Navigated, and DocumentCompleted events occur when you set this property, and the value of the Url property is no longer meaningful.

Note

This property contains the contents of the current document, even if another document has been requested. If you set the value of this property and then immediately retrieve it again, the value retrieved may be different than the value set if the WebBrowser control has not had time to load the new content. You can retrieve the new value in a DocumentCompleted event handler.

To access the contents of a Web page as a string, use the DocumentText property. You can also access the page contents using the HTML document object model (DOM) through the Document property.

Applies to

See also